Tutorial by Examples

To generate an ActiveRecord model that automagically creates the correct db migrations & boilerplate test files for your model, enter this command rails generate model NAME column_name:column_type 'NAME' is the name of the model. 'field' is the name of the column in the DB table and 'type' i...
You can generate a rails migration file from the terminal using the following command: rails generate migration NAME [field[:type][:index] field[:type][:index]] [options] For a list of all the options supported by the command, you could run the command without any arguments as in rails generate ...
DISCLAIMER: Scaffolding is not recommended unless it's for very conventional CRUD apps/testing. This may generate a lot of files(views/models/controllers) that are not needed in your web application thus causing headaches(bad :(). To generate a fully working scaffold for a new object, including mod...
we can create a new controller with rails g controller command. $ bin/rails generate controller controller_name The controller generator is expecting parameters in the form of generate controller ControllerName action1 action2. The following creates a Greetings controller with an action of hell...

Page 1 of 1