aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_many_through_association.rb
diff options
context:
space:
mode:
authorSteven Soroka <ssoroka78@gmail.com>2008-05-01 14:09:12 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-05-01 14:22:55 -0500
commit9c20391bbe6ec1c56f8c8ed4aefb31a93576f76a (patch)
treefb66a893a06c0a0f452748d808f10a5d74faf61f /activerecord/lib/active_record/associations/has_many_through_association.rb
parentc353794dff580c8aa63b357b2857c1fadff3104b (diff)
downloadrails-9c20391bbe6ec1c56f8c8ed4aefb31a93576f76a.tar.gz
rails-9c20391bbe6ec1c56f8c8ed4aefb31a93576f76a.tar.bz2
rails-9c20391bbe6ec1c56f8c8ed4aefb31a93576f76a.zip
best solution?
Signed-off-by: Steven Soroka <ssoroka78@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record/associations/has_many_through_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/has_many_through_association.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb
index ebea313c18..f683669615 100644
--- a/activerecord/lib/active_record/associations/has_many_through_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_through_association.rb
@@ -10,14 +10,14 @@ module ActiveRecord
def create!(attrs = nil)
@reflection.klass.transaction do
- self << (object = @reflection.klass.send(:with_scope, :create => attrs) { @reflection.klass.create! })
+ self << (object = attrs ? @reflection.klass.send(:with_scope, :create => attrs) { @reflection.klass.create! } : @reflection.klass.create!)
object
end
end
def create(attrs = nil)
@reflection.klass.transaction do
- self << (object = @reflection.klass.send(:with_scope, :create => attrs) { @reflection.klass.create })
+ self << (object = attrs ? @reflection.klass.send(:with_scope, :create => attrs) { @reflection.klass.create } : @reflection.klass.create)
object
end
end