Displaying 1 result from an estimated 1 matches for "reason_attributes".
2008 Aug 31
9
assigning collection values and exceptions
hi everyone,
I''ve this code in my Report model:
has_many :report_reasons, :validate => true
has_many :reasons, :through => :report_reasons #, :uniq => true
# :accessible => true
def reason_attributes=(reason_attributes)
reasons.clear
reason_attributes.uniq.each do |reason|
reasons << Reason.find_or_create_by_content(reason)
end
end
What I''m trying to accomplish (and what works) is to have a form which
can submit to a Report some Reason via fields_for (R...