ruby - Rails model that joins through a join table -
Is this possible?
An event can occur many times in an event (i.e., if it is a 3 day event and every day it is on a different time). Every time there is a place associated with it. Finally, an address of each place is associated with it. Now, can I refer those incidents through my incident model?
I'm thinking something like this:
class event & lt; ActiveRecord :: Base is has_many: Time is Place_mera: Location: By: = & gt; : In time-space- Medium: Addresses: via = & gt; : Place Address: Through & gt; : Places
This is the correct syntax.
class event & lt; ActiveRecord :: Base has has_many: time_places has_many: locations, via = & gt; : The time_places are_maya: addresses ,: through = & gt; : Places
Nevertheless work should be done, you may want to redesign your database. Running a lot of connecting queries requires an intensive database extension and makes your application a lot slower.
Comments
Post a Comment