I have these models: Expenses, ScheduledCourses and 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 to find all the expenses associated with a particular scheduled_course. But the expenses have a scheduled_session_id not a scheduled_course_id.
How could I do that?
预定课程:
has_many :expenses, :through => :scheduled_sessions
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.