diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 849f01a047..d3f1347e03 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -118,22 +118,22 @@ module ActiveRecord # user.last_name = "O'Hara" # end # # => - def first_or_create(*args, &block) - first || create(*args, &block) + def first_or_create(attributes = nil, options = {}, &block) + first || create(attributes, options, &block) end # Like first_or_create but calls create! so an exception is raised if the created record is invalid. # # Expects arguments in the same format as Base.create!. - def first_or_create!(*args, &block) - first || create!(*args, &block) + def first_or_create!(attributes = nil, options = {}, &block) + first || create!(attributes, options, &block) end # Like first_or_create but calls new instead of create. # # Expects arguments in the same format as Base.new. - def first_or_new(*args, &block) - first || new(*args, &block) + def first_or_new(attributes = nil, options = {}, &block) + first || new(attributes, options, &block) end alias :first_or_build :first_or_new