diff options
author | Ladislav Smola <lsmola@redhat.com> | 2016-04-06 05:46:55 +0200 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-04-06 00:46:55 -0300 |
commit | cb4f6875b6a27894f3456cda79cb929f7243a1ac (patch) | |
tree | 3105b7d6541b48c59623d572a2fe8ac39a47be78 /activerecord/test/models | |
parent | ff982e4188c571f350a7c2b7528862cfd86ef305 (diff) | |
download | rails-cb4f6875b6a27894f3456cda79cb929f7243a1ac.tar.gz rails-cb4f6875b6a27894f3456cda79cb929f7243a1ac.tar.bz2 rails-cb4f6875b6a27894f3456cda79cb929f7243a1ac.zip |
Fix undefined method `owners' for NullPreloader:Class
* Fix undefined method `owners' for NullPreloader:Class
Fixing undefined method `owners' for
ActiveRecord::Associations::Preloader::NullPreloader:Class
* Use Ruby 1.9 hash format
Use Ruby 1.9 hash format
#24192
[Rafael Mendonça França + Ladislav Smola]
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/owner.rb | 3 | ||||
-rw-r--r-- | activerecord/test/models/pet.rb | 3 | ||||
-rw-r--r-- | activerecord/test/models/pet_treasure.rb | 6 |
3 files changed, 11 insertions, 1 deletions
diff --git a/activerecord/test/models/owner.rb b/activerecord/test/models/owner.rb index cedb774b10..ce8242cf2f 100644 --- a/activerecord/test/models/owner.rb +++ b/activerecord/test/models/owner.rb @@ -1,7 +1,8 @@ class Owner < ActiveRecord::Base self.primary_key = :owner_id has_many :pets, -> { order 'pets.name desc' } - has_many :toys, :through => :pets + has_many :toys, through: :pets + has_many :persons, through: :pets belongs_to :last_pet, class_name: 'Pet' scope :including_last_pet, -> { diff --git a/activerecord/test/models/pet.rb b/activerecord/test/models/pet.rb index f7970d7aab..53489fa1b3 100644 --- a/activerecord/test/models/pet.rb +++ b/activerecord/test/models/pet.rb @@ -4,6 +4,9 @@ class Pet < ActiveRecord::Base self.primary_key = :pet_id belongs_to :owner, :touch => true has_many :toys + has_many :pet_treasures + has_many :treasures, through: :pet_treasures + has_many :persons, through: :treasures, source: :looter, source_type: 'Person' class << self attr_accessor :after_destroy_output diff --git a/activerecord/test/models/pet_treasure.rb b/activerecord/test/models/pet_treasure.rb new file mode 100644 index 0000000000..1fe7807ffe --- /dev/null +++ b/activerecord/test/models/pet_treasure.rb @@ -0,0 +1,6 @@ +class PetTreasure < ActiveRecord::Base + self.table_name = "pets_treasures" + + belongs_to :pet + belongs_to :treasure +end |