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! :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---