search for: evaluate_duplicate_category

Displaying 1 result from an estimated 1 matches for "evaluate_duplicate_category".

2006 Jun 14
3
Prevent duplicate HABTM associations
...the model association but this would only prevent it from displaying duplicates, I want to stop duplicate associations being inserted in the first place. I have a vague idea of something using a callback to check before adding. has_and_belongs_to_many :catalogue_categories, :before_add => :evaluate_duplicate_category def evaluate_duplicate_category(catalogue_category) #check duplicate #if so raise error and abort add end However I am unsure how to abort the add at this stage and return an error. Could anyone help point me in the right direction? Thanks, Andrew. -- Posted via http://www.ruby-forum...