ruby - Rails 3. How to find an associated model through another model? -


i have these models: expenses, scheduledcourses , scheduledsessions.

scheduled_courses has_many scheduled_sessions scheduled_sessions belongs_to scheduled_courses  expenses has_many scheduled_sessions scheduled_sessions belongs_to expenses 

i need find expenses associated particular scheduled_course. expenses have scheduled_session_id not scheduled_course_id.

how that?

scheduled_course:

has_many :expenses, :through => :scheduled_sessions 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

javascript - Preserving URL fragment through CAS sign-on -

asp.net mvc - Implementing normal user/pass, Twitter & Facebook auth -