Hi everyone.
I've got the following in my model:
class Newsletter < ActiveRecord::Base has_and_belongs_to_many :tags
def tag_attributes=(tag_attributes) tag_attributes.each do |attributes| tags.build(attributes) end end end
class Tag < ActiveRecord::Base has_and_belongs_to_many :newsletters end
And I also got a newsletters_tags relationship table in my DB, containing newsletter_id and tag_id (both fields are set as primary_key)
How do I perform a search to retrieve every tag within a particular newsletter, or all newsletters that relates to an specific tag?