Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make scaffold only for controller and views if model already exists? [duplicate]

I already have set up Devise to My App.
So User model is already generated, and exists by installing Devise

Now I'd like to add my own controller users_controller.rb and its views index and show.
How can I make scaffold without affecting to User model that already exists?

like image 553
MKK Avatar asked Jul 26 '12 04:07

MKK


3 Answers

Try this ,

rails g scaffold_controller controller_name 

You will find more options via

rails generate -h
like image 52
RailsEnthusiast Avatar answered Nov 16 '22 08:11

RailsEnthusiast


For scaffold with only 'name' column:

rails g scaffold User name --skip

Just add some columns.

Look to rails g scaffold -h output for additional information.

like image 28
denis.peplin Avatar answered Nov 16 '22 07:11

denis.peplin


If you want just controller and views without the whole scaffold you can do:

rails generate controller Users index show
like image 14
Sabar Avatar answered Nov 16 '22 06:11

Sabar