In the code below, p.comments.foobar calls #foobar on every comment. Is there a way to call #foobar only on the comments that belong to post "p"?
-------------------- class Comment < ActiveRecord::Base belongs_to :post def self.foobar; end end class Post < ActiveRecord::Base has_many :comments end p = Post.find_by_id 123 p.comments.foobar -------------------- Thanks, Nick --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---