aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorTobias Lütke <tobias.luetke@gmail.com>2006-01-10 22:15:49 +0000
committerTobias Lütke <tobias.luetke@gmail.com>2006-01-10 22:15:49 +0000
commit16718e3e218cf5ad00943cc14e97938e2b3b2ca7 (patch)
tree77ab83f03c8191cc1c0fa1f55bffd40ce6ece7be /activerecord/lib/active_record/base.rb
parent7dd2d38b9aeccc5b9dab3044915b80ae32a2c075 (diff)
downloadrails-16718e3e218cf5ad00943cc14e97938e2b3b2ca7.tar.gz
rails-16718e3e218cf5ad00943cc14e97938e2b3b2ca7.tar.bz2
rails-16718e3e218cf5ad00943cc14e97938e2b3b2ca7.zip
Fixed that .with_scope imposed create parameters bypass attr_protected
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3393 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-xactiverecord/lib/active_record/base.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 7ba5beb12b..dc3dc2afa6 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -444,9 +444,10 @@ module ActiveRecord #:nodoc:
if attributes.is_a?(Array)
attributes.collect { |attr| create(attr) }
else
- attributes.reverse_merge!(scope(:create)) if scoped?(:create)
-
object = new(attributes)
+ if scoped?(:create)
+ scope(:create).each { |att,value| object.send("#{att}=", value) }
+ end
object.save
object
end