Skip to content

Commit

Permalink
mattr_accessor default_rejected_delegate_columns replaced with class_…
Browse files Browse the repository at this point in the history
…inheritable_accessor for better customization
  • Loading branch information
pahanix committed Jan 8, 2010
1 parent 826da22 commit d87b96a
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/delegate_belongs_to.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
module DelegateBelongsTo

module ClassMethods

# TODO class inheritance accessor
@@default_rejected_delegate_columns = ['created_at','created_on','updated_at','updated_on','lock_version','type','id','position','parent_id','lft','rgt']
mattr_accessor :default_rejected_delegate_columns

##
# Creates methods for accessing and setting attributes on an association. Uses same
# default list of attributes as delegates_to_association.
Expand Down Expand Up @@ -64,10 +59,11 @@ def delegates_attributes_to(association, *attributes)

end

def self.included(receiver)
receiver.extend ClassMethods
def self.included(base)
base.extend ClassMethods
base.class_inheritable_accessor :default_rejected_delegate_columns
base.default_rejected_delegate_columns = ['created_at','created_on','updated_at','updated_on','lock_version','type','id','position','parent_id','lft','rgt']
end

end

ActiveRecord::Base.send :include, DelegateBelongsTo

0 comments on commit d87b96a

Please sign in to comment.