I have a model that looks something like this:
class Person < ActiveRecord::Base
I’d like to override/overload the append (<<) method for the tasks
relational attribute such that I can perform some error checking in
the context of a Person.tasks << task operation. Is there any way to
I wish I could do this in the context of validation, but it appears
that appending a task instance to a list associated with a person
instance causes the model to be saved in the database even if doing
the operation would cause validation to fail. i.e., person.valid?
will return false as one would expect, but the data will persist!
I’d love your input on this matter.