mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Stop the build asploding on 1.8.7
This commit is contained in:
@@ -105,6 +105,8 @@ module ActiveRecord
|
||||
# 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)).
|
||||
def read_attribute(attr_name)
|
||||
return unless attr_name
|
||||
|
||||
attr_name = attr_name.to_s
|
||||
methods = self.class.generated_external_attribute_methods
|
||||
|
||||
|
||||
@@ -707,6 +707,10 @@ class AttributeMethodsTest < ActiveRecord::TestCase
|
||||
Topic.undefine_attribute_methods
|
||||
end
|
||||
|
||||
def test_read_attribute_with_nil_should_not_asplode
|
||||
assert_equal nil, Topic.new.read_attribute(nil)
|
||||
end
|
||||
|
||||
private
|
||||
def cached_columns
|
||||
@cached_columns ||= time_related_columns_on_topic.map(&:name)
|
||||
|
||||
Reference in New Issue
Block a user