Question

I'm wondering if there is a way to generate scaffolding against a specific database. I am using two databases in my app and would like to generate scaffolding for both, separately. This is assuming that the scaffold generator still uses the database to generate views in rails 2.3.4, which may not be the case.

Thanks in advance.

Was it helpful?

Solution

I haven't test it, but would this work?

RAILS_ENV=test script/generate scaffold Whatever

OTHER TIPS

You define the fields for the resource when running the scaffold, this will generate the views, model, controller, tests and the migrate file (which is then used to create the database table).

For example: rails generate scaffold Post name:string title:string content:text

Scaffold works in reverse of what you seem to be trying to achieve.

http://guides.rubyonrails.org/getting_started.html#creating-a-resource

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top