This project is archived and is in readonly mode.
polymorphic_url behaviour changed in 2.3.0 RC1
-
Wincent Colaiuta
My workaround to restore the pre-2.3.0 behaviour is to change this in the AtomFeedHelper:
@view.polymorphic_url(model)To:
@view.polymorphic_url(model, :format => nil)So evidently that doesn't revert to the previously established behaviour for all users of polymorphic_url(), but at least it fixes it in the place where I ran into the bug (in my Atom feeds).
-
Wincent Colaiuta
Was just chatting to a friend via IM trying to explain the issue and he made a comment that reveals that people might understand what I'm saying here.
He said, "the sudden change sucks, but I have to admit I prefer the new behaviour. in your ticket, with the http://example.com/foo/12 example http://example.com/foo/12.atom for the atom feed is better IMO. still looks neat and clean, but now its format is explicit. how it should be IMO."
So to avoid any potential confusion, let me clarify:
"foo/12" gives you the HTML version of the resource
so when you click on the "read more" link in your feed reader, you are taken to the HTML page
now, with the new behaviour, you click on the link and you're taken to "foo/12.atom"
at best, you'll get an XML representation of the record (most likely not what you were expecting when you clicked "read more"!)
at worst, you won't get anything at all because the app most likely isn't set up to have atom feeds for individual records
-
Wincent Colaiuta
Just found another place with related breakage in my atom.builder templates.
There is one in my app where instead of just letting the standard polymorphic_url() behaviour kick in I am actually passing in an explicit URL:
for comment in @comments feed.entry comment, :url => issue_url(@issue) + "\#comment_#{comment.id}" do |entry| ... etcTurns out that in this context, issue_url() also generates ".atom" links by default. Even stranger, passing in an explicit :format parameter has no effect at all inside the builder template (yet it does from other places, like script/console).
So looks like the change to polymorphic_url() is really only just scratching the surface. Looks like this goes much deeper.
-
DHH
Format shouldn't be inherited for named urls.
-
josh
- State changed from new to open
This is not just polymorphic_url. It also affects url_for. The problem is related to the optional segment implementation for formats.
-
Repository
- State changed from open to resolved
(from [638b3b15a13c4e274cfb317c40248e9feea3bfae]) Generating routes with optional format segment does not inherit params format [#2043 polymorphic_url behaviour changed in 2.3.0 RC1 state:resolved] http://github.com/rails/rails/co...
-
Wincent Colaiuta
Thanks.
