aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorSergey Nartimov <just.lest@gmail.com>2011-12-24 21:26:15 +0300
committerSergey Nartimov <just.lest@gmail.com>2011-12-24 21:26:15 +0300
commit9813c62330afa59e9f6f52eb5d07cf713b5b8968 (patch)
tree8ed56bad2da1cde3925ee8ce47b130052225a516 /activemodel/lib
parentcf0fd053cd197250abaf693adcdbf9d12f24e350 (diff)
downloadrails-9813c62330afa59e9f6f52eb5d07cf713b5b8968.tar.gz
rails-9813c62330afa59e9f6f52eb5d07cf713b5b8968.tar.bz2
rails-9813c62330afa59e9f6f52eb5d07cf713b5b8968.zip
remove deprecated define_attr_method from ActiveModel::AttributeMethods
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/attribute_methods.rb41
1 files changed, 0 insertions, 41 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb
index dba059eacd..d7ec7e6ca5 100644
--- a/activemodel/lib/active_model/attribute_methods.rb
+++ b/activemodel/lib/active_model/attribute_methods.rb
@@ -66,47 +66,6 @@ module ActiveModel
end
module ClassMethods
- def define_attr_method(name, value=nil, deprecation_warning = true, &block) #:nodoc:
- # This deprecation_warning param is for internal use so that we can silence
- # the warning from Active Record, because we are implementing more specific
- # messages there instead.
- #
- # It doesn't apply to the original_#{name} method as we want to warn if
- # people are calling that regardless.
- if deprecation_warning
- ActiveSupport::Deprecation.warn("define_attr_method is deprecated and will be removed without replacement.")
- end
-
- sing = singleton_class
- sing.class_eval <<-eorb, __FILE__, __LINE__ + 1
- remove_possible_method :'original_#{name}'
- remove_possible_method :'_original_#{name}'
- alias_method :'_original_#{name}', :'#{name}'
- define_method :'original_#{name}' do
- ActiveSupport::Deprecation.warn(
- "This method is generated by ActiveModel::AttributeMethods::ClassMethods#define_attr_method, " \
- "which is deprecated and will be removed."
- )
- send(:'_original_#{name}')
- end
- eorb
- if block_given?
- sing.send :define_method, name, &block
- else
- # If we can compile the method name, do it. Otherwise use define_method.
- # This is an important *optimization*, please don't change it. define_method
- # has slower dispatch and consumes more memory.
- if name =~ NAME_COMPILABLE_REGEXP
- sing.class_eval <<-RUBY, __FILE__, __LINE__ + 1
- def #{name}; #{value.nil? ? 'nil' : value.to_s.inspect}; end
- RUBY
- else
- value = value.to_s if value
- sing.send(:define_method, name) { value }
- end
- end
- end
-
# Declares a method available for all attributes with the given prefix.
# Uses +method_missing+ and <tt>respond_to?</tt> to rewrite the method.
#