# Best way to turn off callbacks

**URL:** <https://www.ruby-forum.com/t/best-way-to-turn-off-callbacks/128785>\
**Category:** Rails\
**Created:** [February 11, 2008, 3:49pm UTC](https://www.ruby-forum.com/t/best-way-to-turn-off-callbacks/128785 "2008-02-11T15:49:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sp00nyg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sp00nyg](https://www.ruby-forum.com/u/sp00nyg)\
**Post date:** [February 11, 2008, 3:49pm UTC](https://www.ruby-forum.com/t/best-way-to-turn-off-callbacks/128785/1 "2008-02-11T15:49:27Z")

</div>

I use callbacks (after\_save, etc.) extensively to rebuild model  
relationships. However, there are times when I don’t want them to  
execute, and I don’t want the caller to know about it. For example,  
if I have a model object with saved search criteria and tags, I want  
to execute the search when the criteria changes but not when the tags  
change. In the end, all I really need to know is what attributes  
changed. I have a scheme involving overriding =, but it doesn’t  
always work (update\_attributes doesn’t use obj.attr = new\_value, for  
example).

Any suggestions?

---

<div class="post-metadata">

**Author:** ![sp00nyg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sp00nyg](https://www.ruby-forum.com/u/sp00nyg)\
**Post date:** [February 11, 2008, 6:44pm UTC](https://www.ruby-forum.com/t/best-way-to-turn-off-callbacks/128785/2 "2008-02-11T18:44:15Z")

</div>

if i didn’t understand you wrong, skip\_xxx\_filter could  
help you. have a look at:  
[http://api.rubyonrails.org/classes/ActionController/Filters/ClassMethods.html#M000320](http://api.rubyonrails.org/classes/ActionController/Filters/ClassMethods.html#M000320)

---

<div class="post-metadata">

**Author:** ![sp00nyg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sp00nyg](https://www.ruby-forum.com/u/sp00nyg)\
**Post date:** [February 11, 2008, 7:56pm UTC](https://www.ruby-forum.com/t/best-way-to-turn-off-callbacks/128785/3 "2008-02-11T19:56:07Z")

</div>

I thought skip\_xxx\_filter was for controllers. I need the model. The  
more I think about it, my issue is not with turning off the contacts.  
What I really need it a simple way to know what attributes changed.  
With that, my callback method can determine whether it will run or  
not.
