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

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

wcf binding - How to create a wsdl file for a WCF service library? -