aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2015-01-30 11:42:54 -0700
committerSean Griffin <sean@thoughtbot.com>2015-01-30 11:42:54 -0700
commitb93b39eff6829ee05ffec1cc8c505f69cbb53fdc (patch)
tree5b37fc7c7d36cc6e0abc2530606ea3acad05362c /activerecord/lib/active_record/attribute_methods
parent155b1b7fe3a1d231fb98a6fb04a21f6eb190b98f (diff)
downloadrails-b93b39eff6829ee05ffec1cc8c505f69cbb53fdc.tar.gz
rails-b93b39eff6829ee05ffec1cc8c505f69cbb53fdc.tar.bz2
rails-b93b39eff6829ee05ffec1cc8c505f69cbb53fdc.zip
Remove most type related predicates from `Column`
Remaining are `limit`, `precision`, `scale`, and `type` (the symbol version). These will remain on the column, since they mirror the options to the `column` method in the schema definition DSL
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r--activerecord/lib/active_record/attribute_methods/query.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/query.rb b/activerecord/lib/active_record/attribute_methods/query.rb
index dc689f399a..83b858aae7 100644
--- a/activerecord/lib/active_record/attribute_methods/query.rb
+++ b/activerecord/lib/active_record/attribute_methods/query.rb
@@ -15,6 +15,7 @@ module ActiveRecord
when false, nil then false
else
column = self.class.columns_hash[attr_name]
+ type = self.class.type_for_attribute(attr_name)
if column.nil?
if Numeric === value || value !~ /[^0-9]/
!value.to_i.zero?
@@ -22,7 +23,7 @@ module ActiveRecord
return false if ActiveRecord::ConnectionAdapters::Column::FALSE_VALUES.include?(value)
!value.blank?
end
- elsif column.number?
+ elsif type.number?
!value.zero?
else
!value.blank?