priya
priya

Reputation: 26759

How do you generate views/controllers/tests given the model

How do you generate views/controllers/tests for a brand new Rails 3.x application which has all the relevant model classes under app/models.

Upvotes: 1

Views: 164

Answers (1)

Vikko
Vikko

Reputation: 1406

In the console type

rails generate controller <controller name> <action1> <action2> <etc..>

For instance

rails generate controller items new create edit update destroy index show

this generates items_controller.rb in app/controllers, new.html.erb, edit.html.erb and other actions in app/views and test templates in test/

Upvotes: 4

Related Questions