Displaying 1 result from an estimated 1 matches for "related_keywords".
Did you mean:
related_keyword
2006 Apr 05
4
validation on before_add callback
problem: validation error is not functionning in callback
callback for many-to-many association:
# keyword.rb
:before_add => :reject_self_related
def reject_self_related(related_keyword)
if (related_keyword == self)
# this does not work:
errors.add(:name, "Relating a keyword to itself is
forbidden!")
raise "Relating a keyword to itself is