Rails gives me URLs that have identifiers in the wrong order. It passes the parent id to the child and the parent id of the parent.
On my routes .rb I have
resources :calendars do
resources :events
end
which rake routestells me sets up good routes, for example.
calendar_event GET /calendars/:calendar_id/events/:id(.:format) {:controller=>"events", :action=>"show"}
Therefore, when I ask you to specify the path for this route from a partial view,
<%= link_to "#{event.name} @ #{event.calendar.name} #{event.calendar.year}", calendar_event_path(event) %>
it gives me a url that has inverted ids ...
http://localhost:3000/calendars/<-eventid->/events/<-calendarid->
Any help would be appreciated.
Edit: in my model, Event belongs_to :calendarand Calendar has_many :events. I also use Mongoid as my ORM and not ActiveRecord, although I hope this is not a problem.
source
share