aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/validations.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/validations.rb')
-rwxr-xr-xactiverecord/lib/active_record/validations.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb
index 3bc0e8fa37..342a4844cc 100755
--- a/activerecord/lib/active_record/validations.rb
+++ b/activerecord/lib/active_record/validations.rb
@@ -717,12 +717,10 @@ module ActiveRecord
# so an exception is raised if the record is invalid.
def create!(attributes = nil)
if attributes.is_a?(Array)
- attributes.collect { |attr| create!(attr) }
+ attributes.collect { |attr| create(attr) }
else
- attributes ||= {}
- attributes.reverse_merge!(scope(:create)) if scoped?(:create)
-
object = new(attributes)
+ scope(:create).each { |att,value| object.send("#{att}=", value) } if scoped?(:create)
object.save!
object
end