0
我有三種模式。它們如下所示如何查詢rails中的多個表?
class User < ApplicationRecord
has_one :shop
has_one :address
end
class Shop < ApplicationRecord
belongs_to :user
end
class Address < ApplicationRecord
belongs_to :user
end
地址模型有state_id列。現在,我想所有的商店,其店的老闆address.state_id
爲123456