I have a habtm that looks like:
report
has_and_belongs_to_many :subscribers
subscriber
has_and_belongs_to_many :reports
When I add a report to a subscriber, I have to run code like:
raise “already there, idiot!” unless
report.subscribers.find_by_id(subscriber_id).nil?
Is there a better way to avoid adding duplicative associations? has_many
:through seems like overkill for this application.
Thanks
–
View this message in context:
http://www.nabble.com/Preventing-Dups-in-HABTM-t1819715.html#a4961706
Sent from the RubyOnRails Users forum at Nabble.com.