Reputation: 11
Everyone,
I want to only make a View
after I've already created Controller
and Model
.
For Example, I've made a Model named Product
and a Controller named Order
via the below command.
rails g controller Order show
rails g model Product
But, I want to add a view which will be named list after crated Model and Controller. And, I need to proceed all independent work which is related with the created view file.
Would you like to tell me how to resolve the issue?
Upvotes: 1
Views: 1423
Reputation: 4558
Although I always create views manually, there is a generator called erb:controller if you really want to do it by a generator.
$ rails g erb:controller Order show
create app/views/order
create app/views/order/show.html.erb
BTW, you can use rails g -h
to see all generators which you can use.
Upvotes: 1
Reputation: 1684
You've created a controller named Order
with an action method called show
. Therefore, I'm assuming you want to create a view for show
.
To do this: create a file called show.html.erb
in the app/views/order
folder and add your HTML code in that file. That's it.
Upvotes: 3