Browse files

includes the fix in the pull request b85de26 mantaining backward comp…

…atibility with older versions of rails
  • Loading branch information...
1 parent 4118191 commit b8a74f8c620640fb0137b3cfeeba63ac9778d243 @saten saten committed Jan 30, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/delocalize/rails_ext/active_record.rb
View
4 lib/delocalize/rails_ext/active_record.rb
@@ -39,7 +39,8 @@ def convert_number_column_value_with_localization(value)
end
alias_method_chain :convert_number_column_value, :localization
- def field_changed?(attr, old, value)
+
+ define_method( (Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new('3.2.9')) ? :field_changed? : :_field_changed? ) do |attr, old, value|
if column = column_for_attribute(attr)
if column.number? && column.null && (old.nil? || old == 0) && value.blank?
# For nullable numeric columns, NULL gets stored in database for blank (i.e. '') values.
@@ -53,7 +54,6 @@ def field_changed?(attr, old, value)
value = column.type_cast(value)
end
end
-
old != value
end
end

0 comments on commit b8a74f8

Please sign in to comment.