In Rails 2.2, if you include a belongs_to or references column in a  
call to the model generator, it will automatically add the belongs_to  
declaration to the model, as well as creating the foreign key column  
in the migration. Seems to me that it would be nice if this capability  
was a bit more consistent.

I've written a path that extends the generator to pass has_many,  
has_one, and has_and_belongs_to_many "pseudo-attributes" through to  
the model, creating the appropriate association declarations without  
adding columns to the migrations or fixtures.

Sample usage:

script/generate model Supplier name:string products:has_many

script/generate model User name:string account:has_one

script/generate model Product name:string parts:has_and_belongs_to_many

http://rails.lighthouseapp.com/projects/8994/tickets/1315-extend-model-generator-to-create-association-declarations
 
  for anyone who wants to have a look.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to