mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
0ed096ddf5
Also removes a false positive test that depends on the fixed bug: At this time, counter_cache does not work with polymorphic relationships (which is a bug). The test was added to make sure that no StaleObjectError is raised when the car is destroyed. No such error is currently raised because the lock version is not incremented by appending a wheel to the car. Furthermore, `assert_difference` succeeds because `car.wheels.count` does not check the counter cache, but the collection size. The test will fail if it is replaced with `car.wheels_count || 0`.
5 lines
158 B
Ruby
5 lines
158 B
Ruby
class Aircraft < ActiveRecord::Base
|
|
self.pluralize_table_names = false
|
|
has_many :engines, :foreign_key => "car_id"
|
|
has_many :wheels, as: :wheelable
|
|
end
|