Permalink
Browse files

Stop the build asploding on 1.8.7

  • Loading branch information...
1 parent 384a60a commit 19bea9f1bd03b4601bf4c38539bff993d3eebc39 @jonleighton jonleighton committed Dec 14, 2011
@@ -105,6 +105,8 @@ def attribute_cast_code(attr_name)
# 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 @@ def test_dispatching_column_attributes_through_method_missing_deprecated
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)

0 comments on commit 19bea9f

Please sign in to comment.