There seems to be a small bug with has_one relationships and resource
in the routes.
Example:
where beta has_one alpha
In routes:
resource alpha
In view:
form_for @alpha --> automatic link is alpah_path(id) and not
alpha_path
and in this case since there is no id in the route, the id takes the
There have been a lot discussion about this a while ago. However, we
couldn't find the way to determine the correct route to use when you have a
singular resource, so it was left unfixable.
The solution you'll have to do is to use `:url`
form_for @alpha, :url => alpha_path
On Tue, Jul 12, 2011 a
What about making the polymorphic routing in rails to try a plural route
first. If it fails, try a singleton route. If it fails, raise.
This is not the nicest and most performant way (the result could be
cached in production so it doesn't really matter in the end) but I guess
it should solve m
I was thinking about the same thing too, but something was blocking me at
that moment. Do you mind digging into the source code and see if it's
possible from your perspective, and then send a pull request if you can
patch it?
Thanks a lot! :)
On Wed, Jul 13, 2011 at 3:20 AM, Corin Langosch
wrote:
On 13 Jul 2011, at 08:20, Corin Langosch wrote:
> What about making the polymorphic routing in rails to try a plural route
> first. If it fails, try a singleton route. If it fails, raise.
>
> This is not the nicest and most performant way (the result could be cached in
> production so it doesn
ORLY? I didn't see that ticket. Lemme have a look!
On Wed, Jul 13, 2011 at 7:50 AM, Andrew White wrote:
>
> On 13 Jul 2011, at 08:20, Corin Langosch wrote:
>
> > What about making the polymorphic routing in rails to try a plural route
> first. If it fails, try a singleton route. If it fails, rai