aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/class
diff options
context:
space:
mode:
authorwycats <wycats@gmail.com>2010-03-17 00:15:55 -0700
committerwycats <wycats@gmail.com>2010-03-17 00:20:09 -0700
commita5587efc1903fd27d4b179753aa6e139445ad18c (patch)
tree7642d070d3f876e4c11b7aea3cded9ec2ffd2d79 /activesupport/lib/active_support/core_ext/class
parentcd9ffd11e13ef6e62eba2cbd5c3760ff04132820 (diff)
downloadrails-a5587efc1903fd27d4b179753aa6e139445ad18c.tar.gz
rails-a5587efc1903fd27d4b179753aa6e139445ad18c.tar.bz2
rails-a5587efc1903fd27d4b179753aa6e139445ad18c.zip
Remove some 1.9 warnings (resulting in some fixed bugs). Remaining AM warnings are in dependencies.
Diffstat (limited to 'activesupport/lib/active_support/core_ext/class')
-rw-r--r--activesupport/lib/active_support/core_ext/class/attribute.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/attribute.rb b/activesupport/lib/active_support/core_ext/class/attribute.rb
index c18905b369..9631a7d242 100644
--- a/activesupport/lib/active_support/core_ext/class/attribute.rb
+++ b/activesupport/lib/active_support/core_ext/class/attribute.rb
@@ -1,5 +1,6 @@
require 'active_support/core_ext/object/singleton_class'
require 'active_support/core_ext/module/delegation'
+require 'active_support/core_ext/module/remove_method'
class Class
# Declare a class-level attribute whose value is inheritable and
@@ -45,12 +46,14 @@ class Class
s.send(:define_method, attr) { }
s.send(:define_method, :"#{attr}?") { !!send(attr) }
s.send(:define_method, :"#{attr}=") do |value|
+ singleton_class.remove_possible_method(attr)
singleton_class.send(:define_method, attr) { value }
end
define_method(attr) { self.class.send(attr) }
define_method(:"#{attr}?") { !!send(attr) }
define_method(:"#{attr}=") do |value|
+ singleton_class.remove_possible_method(attr)
singleton_class.send(:define_method, attr) { value }
end if instance_writer
end