Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove private attribute reader

  • Loading branch information...
commit 6e43fcb33365c66359e6363abdc2d108aef9fd67 1 parent b670d79
Aaron Patterson tenderlove authored
8 activerecord/lib/active_record/attribute_methods.rb
View
@@ -37,7 +37,7 @@ def define_attribute_methods # :nodoc:
# Use a mutex; we don't want two thread simultaneously trying to define
# attribute methods.
generated_attribute_methods.synchronize do
- return false if attribute_methods_generated?
+ return false if @attribute_methods_generated
superclass.define_attribute_methods unless self == base_class
super(column_names)
@attribute_methods_generated = true
@@ -45,12 +45,8 @@ def define_attribute_methods # :nodoc:
true
end
- def attribute_methods_generated? # :nodoc:
- @attribute_methods_generated
- end
-
def undefine_attribute_methods # :nodoc:
- super if attribute_methods_generated?
+ super if @attribute_methods_generated
@attribute_methods_generated = false
end
4 activerecord/test/cases/attribute_methods/read_test.rb
View
@@ -56,9 +56,9 @@ def test_define_attribute_methods
end
def test_attribute_methods_generated?
- assert(!@klass.attribute_methods_generated?, 'attribute_methods_generated?')
+ assert_not @klass.method_defined?(:one)
@klass.define_attribute_methods
- assert(@klass.attribute_methods_generated?, 'attribute_methods_generated?')
+ assert @klass.method_defined?(:one)
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.