Anchors in urls created with ActionController::UrlWriter (Ticket #6771)

Hi, ages ago I noticed a regression in 1.2 that I didn't get to fix at the time. The app stayed pre 1.2 until now for various other reasons, but is now being upgraded.

The problem is to do with using something like book_url(:id => 1, :anchor => 'foo') inside a test, e.g. in an assert_select on generated html. Rather than make /book/1#foo it's creating /book/1?anchor=foo.

I've figured out what's happening and created patches for trunk and 1.2-stable, any chance these could be applied?

Longer term, it seems UrlWriter not using UrlRewriter.rewrite is not very DRY. If this patch gets applied (meaning I don't have to work on something to apply it when we deploy :slight_smile: ) I'll look into DRYing that up. The problem seems to be UrlRewriter needs a request and params when it's created. It seems to me these could be 'faked' with an ostruct and a hash in UrlWriter.

Cheers,

Chris

Applied in 6648 [1] -- thanks for the patch and the tests. :slight_smile:

Feel free to proceed with a refactoring, it's definitely deserved.

Regards, Nicholas Seckar

[1] http://dev.rubyonrails.org/changeset/6648

Thanks Nicholas,

Any chance the 1.2-stable patch can be applied to that branch too? That's what we're aiming for.

Cheers,

Chris

Any chance the 1.2-stable patch can be applied to that branch too? That's what we're aiming for.

There you go, Chris. Thanks for the patches :slight_smile:

http://dev.rubyonrails.org/changeset/6651

Thanks Rick

Chris