In my Rails application I have an Images
class that is used by Store
& Maker
, I've set Images
up as belong to a polymorphic association through imageable
(following most of the standard docs and Railscasts), most of it works, however when I add a back button to an image I'm not sure what I'm actually meant to put in for the options:
polymorphic_path(@imageable.images)
Doesn't work: image_image_image_image_image_path
is the resulting thrown error, and various different combinations of ([@imageable, images])
and so on haven't helped. @imageable
definitely points to the correct class though, if I leave it as polymorphic_path(@imageable)
it'll return to the show
for the passed object.
I'm guessing I've misunderstood how I'm passing the objects in but I can't see where.
Edit: just to clarify, by back I mean returning to the index of images for the object.
Edit: just to expand on what I've tried, polymorphic_url
returns the same issue. imageable_images_path
doesn't work as it's not a :resource
in routes.rb
, [@imageable, images]
returns that images
is an undefined.
Edit: To save turning this into a giant I'll add the relevant files as gists:
- Routes.rb https://gist.github.com/nicholassmith/6239704
- Image.rb https://gist.github.com/nicholassmith/6239708
- Store.rb https://gist.github.com/nicholassmith/6239717
- The relevant
rake routes
output https://gist.github.com/nicholassmith/6239971