У меня отношение ниже
Rails: сфера от родителей родителей родителей
School
has_many :students
has_many :accounts, :through => :students
Student
belongs_to :school
has_one :account
Account
belongs_to :student
Это вопрос, у меня есть несколько школ
, и я хочу, чтобы получить счета принадлежит конкретной школе с pagination
Как я могу загрузить это?
@accounts = Accounts.where(...).page(params[:page]).per(10)
Я пропустил мой вопрос
У меня отношение ниже
School
has_many :classrooms
Classroom
belongs_to :school
has_many :students
has_many :accounts, :through => :students
Student
belongs_to :classroom
has_one :account
Account
belongs_to :student
и вопрос в том же :)
Я обновил свой ответ, чтобы соответствовать обновлению на ваш вопрос – oreoluwa