DEV Community

Cover image for Rails power
Gabrielle Easton for Our Time For Tech

Posted on • Updated on

Rails power

I am impressed with what Rails can do with one command. The challenge comes with understanding what happens under the hood.

This week I tried to understand what files and functionality were created after I ran the command Scaffold. Scaffolding in Ruby on Rails refers to the automatic generation of a simple set of a model, views, and controller, usually for a single table.

Here is the command I ran:

bin/rails generate scaffold Shift shift_status:boolean role_name:string shift_start:datetime shift_end:datetime shift_pay:integer
Enter fullscreen mode Exit fullscreen mode

It created not only the model, views, and the controller, but also created test files for the models and views, a helper file for the shifts, sass files for styling, and even a ‘shifts’ resource in the routes file, which defines all possible routes for our shifts.

We can take a quick look at the routes created for us using resources by running the rails routes command.

Alt Text

Here is the view we are getting if we follow localhost:3000/shifts

Alt Text

The next step will be to add logic to controllers and association between other data(tables) in our application.

Lastly, I'd like to say a big THANK YOU to Arit, our senior engineer. I feel very supported and motivated to learn. Thank you for creating a welcoming and supportive environment.❤️

Thanks for reading!

Photo by Lopez Robin on Unsplash

Top comments (1)

aritdeveloper profile image
Arit Developer

😅 Yup, @gabrielleeaston , Rails has been said to be "deceptively simple" 😆 But as you are discovering, a WHOLE LOT happens under the hood.