Topic: Don't get access to associated Tables with .include()
Hey guys,
I'm a beginner in coding Rails and have a problem with joining tables. I have 2 models:
class Price < ActiveRecord::Base
belongs_to :product
end
class Product < ActiveRecord::Base
has_many :prices
endNow I want to get a List of all Products with their prices. (One product has many prices, because I want to save price changes).
I tryed
Product.includes(:prices).allbut this only returns the whole Product table without the prices.
With .joins() it's the same.
Any suggestions?
Charon