I defined the relationship of two tables as below:
Programme(id,code,name)
Course(id,code,name)
ProgarmmeCourse(id,programme_id,course_id,status)
class Programme < ActiveRecord::Base
has_many :programme_courses,:dependent=>:destroy
end
class ProgrammeCourse < ActiveRecord::Base
belongs_to :programme
belongs_to :course
end
class Course < ActiveRecord::Base
has_many :programmes,:through=>:programme_courses
end
there are a list of courses belong to a programme on Programme's update
page, i can update the status(enable/disable) of course belong to the
programme or add a new course from a list of course.
how to save the field of status(enable/disable) effectively after save
Programme?
Could you please give me a sample?
Thanks for your help
--
View this message in context:
http://www.nabble.com/How-to-update-the-extra-field-of-relationship-table-when-use-have_many-%3Athrouth-effectively-tp19952307p19952307.html
Sent from the RubyOnRails Users mailing list archive at Nabble.com.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---