The below doesn’t work but illustrates what I’m looking for:
class Group < AR
has_many :users
def users=(new_users) @old_users = users
write_attribute(‘users’, new_users)
end
end
I’m currently doing something like this:
class Group < AR
has_many :users
def validate_on_update
old_users = Group.find(id).users #Do the checks here…
end
end
But that’s nasty. Anyone know if there’s a plugin that allows AR to
contain a version of the object in the state it had as it got read
from the DB for later comparison?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.