# 'Unsetting' methods/associations on a model?

**URL:** <https://www.ruby-forum.com/t/unsetting-methods-associations-on-a-model/131175>\
**Category:** Rails\
**Created:** [March 6, 2008, 5:51pm UTC](https://www.ruby-forum.com/t/unsetting-methods-associations-on-a-model/131175 "2008-03-06T17:51:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![camerony](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@camerony](https://www.ruby-forum.com/u/camerony)\
**Post date:** [March 6, 2008, 5:51pm UTC](https://www.ruby-forum.com/t/unsetting-methods-associations-on-a-model/131175/1 "2008-03-06T17:51:48Z")

</div>

An example of an ActiveRecord model

class Product \< ActiveRecord::Base  
include ProductMethods  
class

which is including a module of methods

module ProductMethods  
def self.included(model)  
model.belongs\_to :brand  
end  
end

Does anyone know if it is possible to ‘unset’ that ‘belongs\_to :brand’  
association from within the Product model?

Been bugging me for ages! 🙂

---

<div class="post-metadata">

**Author:** ![camerony](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@camerony](https://www.ruby-forum.com/u/camerony)\
**Post date:** [March 11, 2008, 6:39pm UTC](https://www.ruby-forum.com/t/unsetting-methods-associations-on-a-model/131175/2 "2008-03-11T18:39:10Z")

</div>

Cameron Yule wrote:

> An example of an ActiveRecord model
> 
> class Product \< ActiveRecord::Base  
> include ProductMethods  
> class
> 
> which is including a module of methods
> 
> module ProductMethods  
> def self.included(model)  
> model.belongs\_to :brand  
> end  
> end
> 
> Does anyone know if it is possible to ‘unset’ that ‘belongs\_to :brand’  
> association from within the Product model?
> 
> Been bugging me for ages! 🙂

Figured this one out;

class Product \< ActiveRecord::Base  
include ProductMethods

undef\_method(:brand)  
undef\_method(:brand=)  
class

HTH someone else 🙂
