Mr Mapes wrote:
> Ryan Bigg wrote:
>> New way is to specify the fields.
>>
>> script/generate scaffold person first_name:string last_name:string
>>
>
> I'm considering Ruby on Rails, but I already have a big database schema,
> and I'd rather not re-type firstname:string lastname:string, for the
> dozens of fields in my dozens of tables. Is there some way for Ruby to
> build the scaffold based on what it finds in the existing database?
> Wasn't that the whole point in previous versions? This seems like a big
> step backwards....
I'm a little late to the party here.
Try this from script/console
>> TableClass.columns.each { |c| puts c.inspect }; nil
You'll see a list of all the columns in the table, along with the data
types and names and so forth. It should be a pleasurable afternoon to
write a script that consumes this and generates a "script/generate
scaffold" command.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---