From 11870117c6d9231b79e8125218728423e9dff207 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Tue, 13 Sep 2011 19:09:01 +0100 Subject: Rename first_or_new to first_or_initialize. For consistency with find_or_initialize_by. Also remove first_or_build alias. --- activerecord/lib/active_record/relation.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'activerecord/lib/active_record/relation.rb') diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index d3f1347e03..ecefaa633c 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -132,10 +132,9 @@ module ActiveRecord # Like first_or_create but calls new instead of create. # # Expects arguments in the same format as Base.new. - def first_or_new(attributes = nil, options = {}, &block) + def first_or_initialize(attributes = nil, options = {}, &block) first || new(attributes, options, &block) end - alias :first_or_build :first_or_new def respond_to?(method, include_private = false) arel.respond_to?(method, include_private) || -- cgit v1.2.3