Having problems on modifying polymorphic_url

Hi!

I’m trying to fix the bug, that polymorphic_url can’t generate the url for resources with a path_prefix with params in it. This is a pretty annoying but, since path_prefix is a good solution to carry the locale (e.g.: :path_prefix => “:locale” → /en/acticles).

I wrote a test and fixed the problem (I now give a Hash to the generated path method), but I also broke some other tests. Actually I’m not sure if it’s my fault or a problem of those tests, as some of them use mocked models. I tried now for several hours to fix these problems, but didn’t managed to fix all. Can someone help me?

The patch is meant to be applied in the actionpack directory.

Actually, I don’t think my solution is very pretty. If someone comes up with a better solution, I’m fine with that. :slight_smile:

Regards, Johannes

patch (2.43 KB)

Actually, I don't think my solution is very pretty. If someone comes up with a better solution, I'm fine with that. :slight_smile:

This has come up several times before, and it's similar to the challenge of having default_url_options respected by the named route generators:

https://rails.lighthouseapp.com/projects/8994/tickets/1251-default_url_options-cant-be-used-with-named-routes

I think I'd be more in favour of a 'fundamental' fix to the mismatch here than a piecemeal one which gets either of these two cases working. Not sure if josh has any ideas from his new router work