Rails Generate Scaffold To generate a fully working scaffold for a new object, including model, controller, views, assets, and tests, use the rails g scaffold command.
$ rails g scaffold Widget name:string price:decimal
invoke active_record
create db/migrate/20160722171221_create_widgets.rb
create app/models/widget.rb
invoke test_unit
create test/models/widget_test.rb
create test/fixtures/widgets.yml
invoke resource_route
route resources :widgets
invoke scaffold_controller
create app/controllers/widgets_controller.rb
invoke erb
create app/views/widgets
create app/views/widgets/index.html.erb
create app/views/widgets/edit.html.erb
create app/views/widgets/show.html.erb
create app/views/widgets/new.html.erb
create app/views/widgets/_form.html.erb
invoke test_unit
create test/controllers/widgets_controller_test.rb
invoke helper
create app/helpers/widgets_helper.rb
invoke jbuilder
create app/views/widgets/index.json.jbuilder
create app/views/widgets/show.json.jbuilder
invoke assets
invoke javascript
create app/assets/javascripts/widgets.js
invoke scss
create app/assets/stylesheets/widgets.scss
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - ruby on rails tutorial - rails guides - ruby rails - rubyonrails - learn ruby on rails - team Copy Code
Then you can run rake db:migrate to set up the database table.