Scope with joins to get data in Rails 3

后端 未结 3 1027
夕颜
夕颜 2021-02-19 19:35

Coming from Rails 2 to Rails 3 I\'ve never worked so hard to understand something (side editorial).

Anyway, In a Rails 3 app i have the following models...

User:

3条回答
  •  被撕碎了的回忆
    2021-02-19 20:09

    Rails 4

    Question.joins(Answer.user_answers)
    

    [ http://guides.rubyonrails.org/active_record_querying.html#joining-tables ]

提交回复
热议问题