aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/finder_methods.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2012-03-12 11:39:19 +0000
committerAndrew White <andyw@pixeltrix.co.uk>2012-03-12 14:12:22 +0000
commit90d96353e6dcd962b182e03f53f2214acde00907 (patch)
tree8279d07b64cc468003f982847689a0ecb79b179f /activerecord/lib/active_record/relation/finder_methods.rb
parent2b9041ba96375467717a79b0d2c5e6ecca038b5e (diff)
downloadrails-90d96353e6dcd962b182e03f53f2214acde00907.tar.gz
rails-90d96353e6dcd962b182e03f53f2214acde00907.tar.bz2
rails-90d96353e6dcd962b182e03f53f2214acde00907.zip
Add dynamic find_or_create_by_{attribute}! method.
(cherry picked from commit 5282485d310d1a6ffcf55e4e7f56ab234e16880d) Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/dynamic_finder_match.rb
Diffstat (limited to 'activerecord/lib/active_record/relation/finder_methods.rb')
-rw-r--r--activerecord/lib/active_record/relation/finder_methods.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb
index 0305e561c8..9a34927857 100644
--- a/activerecord/lib/active_record/relation/finder_methods.rb
+++ b/activerecord/lib/active_record/relation/finder_methods.rb
@@ -290,7 +290,7 @@ module ActiveRecord
r.assign_attributes(unprotected_attributes_for_create, :without_protection => true)
end
yield(record) if block_given?
- record.save if match.instantiator == :create
+ record.send(match.save_method) if match.save_record?
end
record