You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an intermediate to advanced change. I'd recommend taking a look at good first issues first if you're not too comfortable with Rails yet.
Problem statement
Our events do not specify a location at the moment. That's obviously a big problem for an event management app.
Solution
We should implement locations as a separate model. That will allow us to share the same location record among different events. For example, let's say the event RailsConf is happening at Oregon Convention Center. When we create that event, we will also create a location record for the Oregon Convention Center.
Then, a month later, Comic-Con schedules an event at the Oregon Convention Center. This time, we should use the existing location record.
This is powerful because it gives us the ability to find all events happening at a given location. We wouldn't have that power if we implemented location as just a string column in the events table.
Implementation details
Location should have its own model backed by a database table.
Location should belong_to events and an event should have_one location.
See video 14 - Creating a Registration Model (add link) for a refresher on setting up these relationships.
The location should have a name column, but I will leave it up to you on how you'd like to implement the address storage. I'd recommend doing some research and explaining the reasoning behind your recommendation.
I'd be happy to review your implementation when I have time. Please open a pull request following these steps:
This is an intermediate to advanced change. I'd recommend taking a look at good first issues first if you're not too comfortable with Rails yet.
Problem statement
Our events do not specify a location at the moment. That's obviously a big problem for an event management app.
Solution
We should implement locations as a separate model. That will allow us to share the same location record among different events. For example, let's say the event RailsConf is happening at Oregon Convention Center. When we create that event, we will also create a location record for the Oregon Convention Center.
Then, a month later, Comic-Con schedules an event at the Oregon Convention Center. This time, we should use the existing location record.
This is powerful because it gives us the ability to find all events happening at a given location. We wouldn't have that power if we implemented location as just a string column in the events table.
Implementation details
belong_to
events and an event shouldhave_one
location.I'd be happy to review your implementation when I have time. Please open a pull request following these steps:
The text was updated successfully, but these errors were encountered: