Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails g scaffold for existing model and DB table

I would like to create a structure with rails g scaffold Article, but I have already created the table Articles and model Articles.

Is there any way to do that?

like image 685
user984621 Avatar asked Mar 21 '12 16:03

user984621


2 Answers

rails generate scaffold_controller Article

like image 167
mikdiet Avatar answered Nov 01 '22 10:11

mikdiet


Use rails generate scaffold_controller Article with parameters, example:

rails g scaffold_controller Article title:string body:text

Create views with attributes in tables

like image 26
Thadeu Esteves Jr. Avatar answered Nov 01 '22 12:11

Thadeu Esteves Jr.