diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2010-08-12 21:37:48 -0400 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-08-19 14:52:15 -0300 |
commit | 2e455429427a4078d2888cc39305f951bdf1e643 (patch) | |
tree | b67aa66e66704aca116fd90f72144528aab563b4 /activerecord/test/models | |
parent | 43f44c1a034497fef0a9ed64e0da6f090b5c3b7e (diff) | |
download | rails-2e455429427a4078d2888cc39305f951bdf1e643.tar.gz rails-2e455429427a4078d2888cc39305f951bdf1e643.tar.bz2 rails-2e455429427a4078d2888cc39305f951bdf1e643.zip |
While creating a new record using has_many create method default scope of child should be respected.
author.posts.create should take into account default_scope
defined on post.
[#3939: state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/bulb.rb | 7 | ||||
-rw-r--r-- | activerecord/test/models/car.rb | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/models/bulb.rb b/activerecord/test/models/bulb.rb new file mode 100644 index 0000000000..9eefc5803a --- /dev/null +++ b/activerecord/test/models/bulb.rb @@ -0,0 +1,7 @@ +class Bulb < ActiveRecord::Base + + default_scope :conditions => {:name => 'defaulty' } + + belongs_to :car + +end diff --git a/activerecord/test/models/car.rb b/activerecord/test/models/car.rb index faf4e6cbc0..903ec53288 100644 --- a/activerecord/test/models/car.rb +++ b/activerecord/test/models/car.rb @@ -1,4 +1,5 @@ class Car < ActiveRecord::Base + has_many :bulbs has_many :tyres has_many :engines has_many :wheels, :as => :wheelable |