Skip to content

Commit

Permalink
Support dirty tracking with rails 3.2.9.rc1
Browse files Browse the repository at this point in the history
Starting with rails 3.2.9.rc1 the method #field_changed?
was renamed to #_field_changed?

rails/rails#3544
  • Loading branch information
ebeigarts committed Oct 31, 2012
1 parent 101816d commit ea66792
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module OracleEnhancedDirty #:nodoc:
module InstanceMethods #:nodoc:
private

def field_changed?(attr, old, value)
def _field_changed?(attr, old, value)
if column = column_for_attribute(attr)
# Added also :decimal type
if (column.type == :integer || column.type == :decimal) && column.null && (old.nil? || old == 0) && value.blank?
Expand Down Expand Up @@ -35,5 +35,10 @@ def field_changed?(attr, old, value)
if ActiveRecord::Base.method_defined?(:changed?)
ActiveRecord::Base.class_eval do
include ActiveRecord::ConnectionAdapters::OracleEnhancedDirty::InstanceMethods
# Starting with rails 3.2.9 the method #field_changed?
# was renamed to #_field_changed?
if private_method_defined?(:field_changed?)
alias_method :field_changed?, :_field_changed?
end
end
end

0 comments on commit ea66792

Please sign in to comment.