From b05e978b0004bffdc28bd7f09986bedd6519e55a Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Wed, 28 May 2014 22:49:13 -0700 Subject: [PATCH 1/2] find(:first) is no longer implemented in activerecord4 --- lib/replicate/active_record.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/replicate/active_record.rb b/lib/replicate/active_record.rb index 0889fdc..f37c49c 100644 --- a/lib/replicate/active_record.rb +++ b/lib/replicate/active_record.rb @@ -269,7 +269,11 @@ def replicate_find_existing_record(attributes) replicate_natural_key.each do |attribute_name| conditions[attribute_name] = attributes[attribute_name.to_s] end - find(:first, :conditions => conditions) + if ::ActiveRecord::VERSION::MAJOR >= 4 + where(conditions).first + else + find(:first, :conditions => conditions) + end end # Update an AR object's attributes and persist to the database without From b5fb6e21c9f2e2b0182ffbe8567192f16a39dcaf Mon Sep 17 00:00:00 2001 From: Natacha Date: Tue, 10 Jan 2017 14:19:37 -0500 Subject: [PATCH 2/2] fixed rails 4.2 localjumperror --- lib/replicate/active_record.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/replicate/active_record.rb b/lib/replicate/active_record.rb index 6acdcee..13c47c2 100644 --- a/lib/replicate/active_record.rb +++ b/lib/replicate/active_record.rb @@ -303,10 +303,10 @@ def replicate_disable_callbacks(instance) def instance.run_callbacks(*args); yield if block_given?; end # AR 3.0.x - def instance._run_save_callbacks(*args); yield; end - def instance._run_create_callbacks(*args); yield; end - def instance._run_update_callbacks(*args); yield; end - def instance._run_commit_callbacks(*args); yield; end + def instance._run_save_callbacks(*args); yield if block_given?; end + def instance._run_create_callbacks(*args); yield if block_given?; end + def instance._run_update_callbacks(*args); yield if block_given?; end + def instance._run_commit_callbacks(*args); yield if block_given?; end else # AR 2.x def instance.callback(*args)