2009/7/1 Raj Singh <rails-mailing-l...@andreas-s.net>: > > A person has_many cars. > > A car has_many lights. > > Can I write a person has_many lights? > > A snippet of code to help me understand will help.
Try person has_many :lights, :through => :cars See http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html for lots of examples of such things. Colin > -- > 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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---