3

I have a model already in place. I just want some admin screens created for it which will do the add/edit/update/delete functionality.

My model name is User and it has properties user_id, first_name, last_name, user_status, created_at, updated_at, updated_by

Is it possible to use the script/generate scaffold on this model so that crud functionality would come on its own and then I can just make it look like rest of the application.

I dont know if it makes a difference but the user model has a has_many through relationship with another table

jei li
  • 31
  • 3
  • It's possible! See [**this SO question and answer**](http://stackoverflow.com/questions/4333393/using-rails-generate-scaffold-when-model-already-exists). – Thomas Klemm Oct 29 '13 at 18:46

2 Answers2

1

I believe you can use nifty_scaffold for this

Omnipresent
  • 29,434
  • 47
  • 142
  • 186
0

Sounds like you simply need an admin controller + views for Users. You should strongly consider name-spacing the admin area (which is easily possible via the following generator in rails 3):

rails generate controller Admin::Users

additionally, if you also want the views generated, based on an existing User model:

rails generate scaffold_controller Admin::Users
amlutz160
  • 448
  • 5
  • 18