Rails for Dummies— Seven Restful Actions

If you are a fan of structure and repetition, you’ll enjoy building with Ruby in these 7 steps. For simplicity’s sake I’ll be outlining the general functionality of each Rails action below. Short and sweet.

Photo by Ilya Pavlov on Unsplash

First up is the #index action, which will help you showcase all of the instances of any model you set up in your app on your index page. On the web, and index page would be a page that displays all products or items. Second comes the #show action, which specifically highlights a particular instance of a class by finding it’s unique identifier. Third is the #new action, which helps you generate an empty form for your user to fill out. Using the form generated by the #new action, your user will enter information in order to complete our fourth action :#create. The #create does exactly what you’d imagine, it creates a new object and adds it to your database. The fifth action, #edit, functions similarly to #new in that it generates a blank form for user input. #update, the penultimate action, modifies your form with inputted user information and saves the changes to your database. Last but not least comes the seventh action, #delete. As you may have already guessed, this action enables you to remove objects from your database.

Latina Software Engineer | Ravenclaw rising | cat lady