# \<model\>.update(...) not calling before\_update callback

**URL:** <https://www.ruby-forum.com/t/model-update-not-calling-before-update-callback/97331>\
**Category:** Rails\
**Created:** [July 6, 2006, 12:04pm UTC](https://www.ruby-forum.com/t/model-update-not-calling-before-update-callback/97331 "2006-07-06T12:04:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/5f9b8f/32.png) [@sam](https://www.ruby-forum.com/u/sam)\
**Post date:** [July 6, 2006, 12:04pm UTC](https://www.ruby-forum.com/t/model-update-not-calling-before-update-callback/97331/1 "2006-07-06T12:04:15Z")

</div>

Hi,

I’m doing a \<model\_name\>.update(…) but I’m noticing that my  
before\_update callback is not being called. If I do a find and then a  
save!, I notice that it is called. The problem with a find and save in  
my case is that I’m not able to set all my attributes in one shot by  
saving params[“user”] and since I can’t do this, my overloaded equality  
def: user=(…) in my model does not get called which I need to call.  
Any help on either of these methods would be great!.

Thanks.

---

<div class="post-metadata">

**Author:** ![sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/5f9b8f/32.png) [@sam](https://www.ruby-forum.com/u/sam)\
**Post date:** [July 6, 2006, 8:05pm UTC](https://www.ruby-forum.com/t/model-update-not-calling-before-update-callback/97331/2 "2006-07-06T20:05:13Z")

</div>

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.

SAm wrote:

> Hi,
> 
> I’m doing a \<model\_name\>.update(…) but I’m noticing that my  
> before\_update callback is not being called. If I do a find and then a  
> save!, I notice that it is called. The problem with a find and save in  
> my case is that I’m not able to set all my attributes in one shot by  
> saving params[“user”] and since I can’t do this, my overloaded equality  
> def: user=(…) in my model does not get called which I need to call.  
> Any help on either of these methods would be great!.
> 
> Thanks.
