Permalink
Browse files

Merge pull request #11150 from jetthoughts/remove_depr_message_for_at…

…tribute_method_matcher

Remove deprecation warning from AttributeMethodsMatcher
  • Loading branch information...
2 parents ca81874 + e63ba91 commit 9a26d94d60d626f3d4d71909455fce1ef2b1a99c @carlosantoniodasilva carlosantoniodasilva committed Jun 28, 2013
@@ -388,14 +388,6 @@ class AttributeMethodMatcher #:nodoc:
AttributeMethodMatch = Struct.new(:target, :attr_name, :method_name)
def initialize(options = {})
- if options[:prefix] == '' || options[:suffix] == ''
- message = "Specifying an empty prefix/suffix for an attribute method is no longer " \
- "necessary. If the un-prefixed/suffixed version of the method has not been " \
- "defined when `define_attribute_methods` is called, it will be defined " \
- "automatically."
- ActiveSupport::Deprecation.warn message
- end
-
@prefix, @suffix = options.fetch(:prefix, ''), options.fetch(:suffix, '')
@regex = /^(?:#{Regexp.escape(@prefix)})(.*)(?:#{Regexp.escape(@suffix)})$/
@method_missing_target = "#{@prefix}attribute#{@suffix}"
@@ -202,17 +202,6 @@ def foo
assert_equal 'bar', m.foo_test
end
- test 'explicitly specifying an empty prefix/suffix is deprecated' do
- klass = Class.new(ModelWithAttributes)
-
- assert_deprecated { klass.attribute_method_suffix '' }
- assert_deprecated { klass.attribute_method_prefix '' }
-
- klass.define_attribute_methods(:foo)
-
- assert_equal 'value of foo', klass.new.foo
- end
-
test 'should not interfere with method_missing if the attr has a private/protected method' do
m = ModelWithAttributes2.new
m.attributes = { 'private_method' => '<3', 'protected_method' => 'O_o' }

0 comments on commit 9a26d94

Please sign in to comment.