Ruby on Rails Saturday, April 30, 2016

What I am trying to do is the following:

I have a Student table with some fields...

I need to join the student in two different ways...

1. The student has a home district
2. The student can be in one or more reporting districts

I understand the join table for the reporting districts, however is it
also possible to have a district_id in the student table as well which
is his/her home district?

Or do I have to do a has many through?

I would like to be able to do

student.district as well as student.reporting_districts or something
similar.

Sorry... Really new to rails and still trying to learn the proper
syntax...

John

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/fcb91a7c878e9245ca6e0a35e59de72f%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment