SHANib
SHANib

Reputation: 718

Rubyonrails-How to do scaffolding for a already existing model?

I already have a model named profile and corresponding database table profiles. Now i would like to create crud operations for this profile model using SCAFFOLDING. how this can be achieved.

Upvotes: 1

Views: 1857

Answers (2)

Vapire
Vapire

Reputation: 4588

I'd go with Replico's answer. But if you really want to use scaffold you could use:

rails generate scaffold_controller NAME

so for you:

rails generate scaffold_controller Profile

see

rails generate scaffold_controller --help

for details.

Upvotes: 3

jamiescript
jamiescript

Reputation: 1284

I would suggest creating the CRUD operations from scratch rather than using scaffold. It'll improve your rails development skills and you don't have to worry about unnecessary generated code from the scaffold - create a sample scaffold if you like to give you a basis to work from.

Alternatively you could 'destroy' the model and recreate in a scaffold, that wont take long at all.

Upvotes: 2

Related Questions