First off, that's a crazy datamodel. I would really try to pull that apart more if you can. Intuitively, there is a noun missing. This would probably make your current problem easier to solve.
That aside, were I trying to solve your problem at hand, I would probably try using association callbacks http://guides.rubyonrails.org/association_basics.html#association-callbacks maybe something like: class Artist has_many :featured_songs, :through => :releases, :after_add => :set_featured_flag def set_featured_flag(featured_song) # haven't done this before on a through relationship before, I think you'll have to search for the release object r = Release.where(:artist => self).where(:song => featured_song) #order by newest if they're not unique? r.featured = true r.save end end -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/810FHkvTw30J. 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.

