Chris McGrath
2007-Apr-29 14:11 UTC
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 :) ) 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
nseckar@gmail.com
2007-May-02 04:42 UTC
Re: Anchors in urls created with ActionController::UrlWriter (Ticket #6771)
Applied in 6648 [1] -- thanks for the patch and the tests. :-) Feel free to proceed with a refactoring, it''s definitely deserved. Regards, Nicholas Seckar [1] http://dev.rubyonrails.org/changeset/6648 On Apr 29, 10:11 am, Chris McGrath <c...@octopod.info> wrote:> 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 :) ) 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Chris McGrath
2007-May-02 15:00 UTC
Re: Anchors in urls created with ActionController::UrlWriter (Ticket #6771)
On 2 May 2007, at 05:42, nseckar@gmail.com wrote:> Applied in 6648 [1] -- thanks for the patch and the tests. :-) > > Feel free to proceed with a refactoring, it''s definitely deserved. > > Regards, > Nicholas Seckar > > [1] http://dev.rubyonrails.org/changeset/6648Thanks Nicholas, Any chance the 1.2-stable patch can be applied to that branch too? That''s what we''re aiming for. Cheers, Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Rick Olson
2007-May-02 21:03 UTC
Re: Anchors in urls created with ActionController::UrlWriter (Ticket #6771)
> 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 :) http://dev.rubyonrails.org/changeset/6651 -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Chris McGrath
2007-May-02 22:14 UTC
Re: Anchors in urls created with ActionController::UrlWriter (Ticket #6771)
On 2 May 2007, at 22:03, Rick Olson wrote:> >> 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 :) > > http://dev.rubyonrails.org/changeset/6651Thanks Rick Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---