'Unsetting' methods/associations on a model?

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! :slight_smile:

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! :slight_smile:

Figured this one out;

class Product < ActiveRecord::Base   include ProductMethods

  undef_method(:brand)   undef_method(:brand=) class

HTH someone else :slight_smile: