diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-05-10 23:35:01 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-05-10 23:35:15 +0100 |
commit | a8c1fa4afd4abe6a5c975a164235600d1b8d8b4e (patch) | |
tree | 22e7e030e97c99315b4a789c5f1570d26db5b144 /activerecord/test/models | |
parent | 93a85ce333db35b96a70ad02418db8866d89fc08 (diff) | |
download | rails-a8c1fa4afd4abe6a5c975a164235600d1b8d8b4e.tar.gz rails-a8c1fa4afd4abe6a5c975a164235600d1b8d8b4e.tar.bz2 rails-a8c1fa4afd4abe6a5c975a164235600d1b8d8b4e.zip |
Add test to specify that attributes from an association's conditions should be assigned without mass-assignment protection when a record is built on the association.
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/bulb.rb | 2 | ||||
-rw-r--r-- | activerecord/test/models/car.rb | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/models/bulb.rb b/activerecord/test/models/bulb.rb index c68d008c26..643dcefed3 100644 --- a/activerecord/test/models/bulb.rb +++ b/activerecord/test/models/bulb.rb @@ -2,6 +2,8 @@ class Bulb < ActiveRecord::Base default_scope where(:name => 'defaulty') belongs_to :car + attr_protected :car_id, :frickinawesome + attr_reader :scope_after_initialize after_initialize :record_scope_after_initialize diff --git a/activerecord/test/models/car.rb b/activerecord/test/models/car.rb index b036f0f5c9..de1864345a 100644 --- a/activerecord/test/models/car.rb +++ b/activerecord/test/models/car.rb @@ -2,6 +2,8 @@ class Car < ActiveRecord::Base has_many :bulbs has_many :foo_bulbs, :class_name => "Bulb", :conditions => { :name => 'foo' } + has_many :frickinawesome_bulbs, :class_name => "Bulb", :conditions => { :frickinawesome => true } + has_many :tyres has_many :engines has_many :wheels, :as => :wheelable |