Guest User

Untitled

a guest
Apr 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. ## app/models/posted_item.rb
  2. class PostedItem < ActiveRecord::Base
  3. # ...
  4. has_many :item_classifications
  5. has_many :taxonomies, :through => 'item_classifications'
  6. # ...
  7. end
  8.  
  9. ## app/models/taxonomy.rb
  10. class Taxonomy < ActiveRecord::Base
  11. has_many :item_classifications
  12. has_many :posted_items, :through => 'item_classifications'
  13. end
  14.  
  15. ## app/models/item_classification.rb
  16. class ItemClassification < ActiveRecord::Base
  17. belongs_to :taxonomy, :counter_cache => :item_count
  18. belongs_to :posted_item
  19. end
  20.  
  21. ## raises: [plain_text]
  22. Internal Server Error 500
  23. Could not find the association "item_classifications" in model Taxonomy
Add Comment
Please, Sign In to add comment