From eb72e62c3042c0df989d951b1d12291395ebdb8e Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 19 Oct 2012 13:18:47 +0100 Subject: Add Relation#find_or_create_by and friends This is similar to #first_or_create, but slightly different and a nicer API. See the CHANGELOG/docs in the commit. Fixes #7853 --- activerecord/lib/active_record/querying.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activerecord/lib/active_record/querying.rb') diff --git a/activerecord/lib/active_record/querying.rb b/activerecord/lib/active_record/querying.rb index 13e09eda53..45f6a78428 100644 --- a/activerecord/lib/active_record/querying.rb +++ b/activerecord/lib/active_record/querying.rb @@ -3,6 +3,7 @@ module ActiveRecord module Querying delegate :find, :take, :take!, :first, :first!, :last, :last!, :exists?, :any?, :many?, :to => :all delegate :first_or_create, :first_or_create!, :first_or_initialize, :to => :all + delegate :find_or_create_by, :find_or_create_by!, :find_or_initialize_by, :to => :all delegate :find_by, :find_by!, :to => :all delegate :destroy, :destroy_all, :delete, :delete_all, :update, :update_all, :to => :all delegate :find_each, :find_in_batches, :to => :all -- cgit v1.2.3