Skip to content

Commit

Permalink
Wrap up attribute method reset concerns in 'undefine_attribute_methods'
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Jul 30, 2009
1 parent 586baf8 commit e129c56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions activerecord/lib/active_record/attribute_methods.rb
Expand Up @@ -79,6 +79,11 @@ def define_attribute_methods
end
end

def undefine_attribute_methods
generated_methods.each { |name| undef_method(name) }
@generated_methods = nil
end

# Checks whether the method is defined in the model or any of its subclasses
# that also derive from Active Record.
def instance_method_already_implemented?(method_name)
Expand Down
4 changes: 2 additions & 2 deletions activerecord/lib/active_record/base.rb
Expand Up @@ -1397,8 +1397,8 @@ def column_methods_hash #:nodoc:
# end
# end
def reset_column_information
generated_methods.each { |name| undef_method(name) }
@column_names = @columns = @columns_hash = @content_columns = @dynamic_methods_hash = @generated_methods = @inheritance_column = nil
undefine_attribute_methods
@column_names = @columns = @columns_hash = @content_columns = @dynamic_methods_hash = @inheritance_column = nil
end

def reset_column_information_and_inheritable_attributes_for_all_subclasses#:nodoc:
Expand Down

0 comments on commit e129c56

Please sign in to comment.