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

37,376

Solution 1

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.

Solution 2

Try this ,

rails g scaffold_controller controller_name 

You will find more options via

rails generate -h

Solution 3

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

rails generate controller Users index show
Share:
37,376
MKK
Author by

MKK

Updated on February 10, 2020

Comments

  • MKK
    MKK over 4 years

    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?