diff options
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 5 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/oracle_adapter.rb | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 812f30c773..fba17bd917 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1646,8 +1646,9 @@ module ActiveRecord #:nodoc: def ==(comparison_object) comparison_object.equal?(self) || (comparison_object.instance_of?(self.class) && - comparison_object.id == id && - !comparison_object.new_record?) + ((!comparison_object.new_record? && comparison_object.id == id) || + (comparison_object.new_record? && comparison_object.attributes == attributes)) + ) end # Delegates to == diff --git a/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb b/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb index e4c9c411b3..cef3c9f6c9 100644 --- a/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb @@ -635,11 +635,11 @@ begin # Adds auto-recovery functionality. # # See: http://www.jiubao.org/ruby-oci8/api.en.html#label-11 - def exec(sql, *bindvars) + def exec(sql, *bindvars, &block) should_retry = self.class.auto_retry? && autocommit? begin - @connection.exec(sql, *bindvars) + @connection.exec(sql, *bindvars, &block) rescue OCIException => e raise unless LOST_CONNECTION_ERROR_CODES.include?(e.code) @active = false |