aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-12-21 10:32:07 -0800
committerJon Leighton <j@jonathanleighton.com>2011-12-21 10:32:07 -0800
commitfa3b9fa87334260f6fbf5713492a43f804b07f5b (patch)
tree5c4695651560bf44eb7e64445e5fbaf045a59d33
parent52c214f7a388d1bf5c43be96c0495259d54f0f0c (diff)
parent9f7d3c51b35f1568df07d949e0d0a55b72b3c514 (diff)
downloadrails-fa3b9fa87334260f6fbf5713492a43f804b07f5b.tar.gz
rails-fa3b9fa87334260f6fbf5713492a43f804b07f5b.tar.bz2
rails-fa3b9fa87334260f6fbf5713492a43f804b07f5b.zip
Merge pull request #4110 from lest/remove-deprecated-underscore-read
remove deprecated underscore versions of attribute methods
-rw-r--r--activerecord/lib/active_record/attribute_methods.rb1
-rw-r--r--activerecord/lib/active_record/attribute_methods/deprecated_underscore_read.rb32
-rw-r--r--activerecord/test/cases/attribute_methods_test.rb8
3 files changed, 0 insertions, 41 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb
index 650fa3fc42..131ef09f57 100644
--- a/activerecord/lib/active_record/attribute_methods.rb
+++ b/activerecord/lib/active_record/attribute_methods.rb
@@ -16,7 +16,6 @@ module ActiveRecord
include TimeZoneConversion
include Dirty
include Serialization
- include DeprecatedUnderscoreRead
# Returns the value of the attribute identified by <tt>attr_name</tt> after it has been typecast (for example,
# "2004-12-12" in a data column is cast to a date object, like Date.new(2004, 12, 12)).
diff --git a/activerecord/lib/active_record/attribute_methods/deprecated_underscore_read.rb b/activerecord/lib/active_record/attribute_methods/deprecated_underscore_read.rb
deleted file mode 100644
index 0eb0db65b1..0000000000
--- a/activerecord/lib/active_record/attribute_methods/deprecated_underscore_read.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-require 'active_support/concern'
-require 'active_support/deprecation'
-
-module ActiveRecord
- module AttributeMethods
- module DeprecatedUnderscoreRead
- extend ActiveSupport::Concern
-
- included do
- attribute_method_prefix "_"
- end
-
- module ClassMethods
- protected
-
- def define_method__attribute(attr_name)
- # Do nothing, let it hit method missing instead.
- end
- end
-
- protected
-
- def _attribute(attr_name)
- ActiveSupport::Deprecation.warn(
- "You have called '_#{attr_name}'. This is deprecated. Please use " \
- "either '#{attr_name}' or read_attribute('#{attr_name}')."
- )
- read_attribute(attr_name)
- end
- end
- end
-end
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb
index 5e9f8028e9..8e509a9792 100644
--- a/activerecord/test/cases/attribute_methods_test.rb
+++ b/activerecord/test/cases/attribute_methods_test.rb
@@ -102,7 +102,6 @@ class AttributeMethodsTest < ActiveRecord::TestCase
def test_respond_to?
topic = Topic.find(1)
assert_respond_to topic, "title"
- assert_respond_to topic, "_title"
assert_respond_to topic, "title?"
assert_respond_to topic, "title="
assert_respond_to topic, :title
@@ -114,19 +113,12 @@ class AttributeMethodsTest < ActiveRecord::TestCase
assert !topic.respond_to?(:nothingness)
end
- def test_deprecated_underscore_method
- topic = Topic.find(1)
- assert_equal topic.title, assert_deprecated { topic._title }
- end
-
def test_respond_to_with_custom_primary_key
keyboard = Keyboard.create
assert_not_nil keyboard.key_number
assert_equal keyboard.key_number, keyboard.id
assert keyboard.respond_to?('key_number')
- assert keyboard.respond_to?('_key_number')
assert keyboard.respond_to?('id')
- assert keyboard.respond_to?('_id')
end
# Syck calls respond_to? before actually calling initialize