I have existing database that I would like to auto generate the controllers and views for including models with field size and not null validation. I looked into a project called the Magic Model Generator but it looked old and only creates models from what I can tell.
I want this as primarily a time saver and I understand that most of the controllers and views will not be useful for user facing functionally. I will be plucking out what I don't need and moving most of it to administration pages.
Is there a tool for doing this?
TIA!
Edit: I want to create the actual files and do not want a dynamic admin. I will be using the controllers and view for some front facing parts of the site.
To generate a fully working scaffold for a new object, including model, controller, views, assets, and tests, use the rails g scaffold command. Then you can run rake db:migrate to set up the database table. Then you can visit http://localhost:3000/widgets and you'll see a fully functional CRUD scaffold.
What is the difference between both static and dynamic Scaffolding? Static Scaffolding needs user insertion commands to generate data fields, whereas Dynamic Scaffolding generates the entire content at run time.
Rails scaffolding is a quick way to generate some of the major pieces of an application. If you want to create the models, views, and controllers for a new resource in a single operation, scaffolding is the tool for the job.
Not sure if works for Rails 3, but does for Rails 4! Steps below teaches how to build your models, forms, controllers and etc from a existing database.
Hope it helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With