Ich habe drei Modelle. Sie sind wie folgt:Wie kann man auf mehreren Tabellen in Schienen abfragen?
class User < ApplicationRecord
has_one :shop
has_one :address
end
class Shop < ApplicationRecord
belongs_to :user
end
class Address < ApplicationRecord
belongs_to :user
end
Das Adressmodell hat die Spalte "state_id". Jetzt möchte ich alle Geschäfte erhalten, die Shop-Besitzer address.state_id
ist 123456.