Reintializing a model object to invoke model callbacks

Any thoughts on this one guys? How do I reinitialize an already
initialized model object in my controller in one shot rather than
manually initializing each attribute? In other words, I do a find like
so:

user = User.find(id)

Now I want to reinitialize the user object by using the params[“user”]

but I’d like to intialize it in a way that calls my model’s equality
operator to do some sepecial initializations defined as so:

In my model

def user=(user)

end


I need to somehow invoke the after_* and before_* callbacks and these
apparently don’t get invoked if I do an update like so:
user.update(…). It seems like I must do a user.save! to invoke them.

Thanks,

Saureen.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs