I’m guessing this is easy, but I still cant do it!!
In my app I have a number of different models describing events,
london_events, new_york_events, scotland_events etc etc, each of these
has columns to describe the events (Venue, time, place, band etc etc)
To display the events, I have a different page for each location (London
/ New York / Scotland), and on that page I make a table with info
columns, Event name, Band Name etc etc, and for each row (event) I want
to have the standard buttons, ‘show’, ‘edit’, ‘delete’.
To keep code DRY I’ve made a generic view “/shared/_index_events_table”
which then gets passed all the events for the location
the generic table code looks like this:
(events_group = @london_events / @scotland_events etc etc…)
Event Name | Band Name | S3 filename | |||
---|---|---|---|---|---|
<%=h event.eventName %> | <%=h event.bandName %> | <%=h event.s3filename %> | <%= link_to 'Show', event %> | <%= link_to "EditOld", edit_london_events_path(event) %> | <%= link_to "EditNew", event/edit %> |
I can get to the edit path for the event using
edit_london_events_path(event)
but this is specific to London, and so I’d need to make a new table for
each location - not DRY!!!
what I’d like is to get the edit path from the event, something like
but this returns "undefined local variable or method `edit’ "
I’ve tried a number of different guesses as to how to do this, but none
of them have worked!
Can anyone tell me how to do this please.
All help appreciated
Mike