Just a quick update--the routing rewrite has been checked in. We''ve already noticed a few things broken and have patching them this morning, but we''d love to hear from those of you willing to test their apps with the bleeding edge. Thanks! - Jamis
I just updated, and noticed no problems. I can''t run full tests right now, but nothing seems broken. I was able to test out my broomstick plugin which uses url for and it still works fine. On Thu, 2006-06-01 at 10:25 -0600, Jamis Buck wrote:> Just a quick update--the routing rewrite has been checked in. We''ve > already noticed a few things broken and have patching them this > morning, but we''d love to hear from those of you willing to test > their apps with the bleeding edge. > > Thanks! > > - Jamis > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-coreCharlie Bowman http://www.recentrambles.com _______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core
I have an application that broke.
This may be an unwanted behaviour, or not, but I was working with this as a
feature for using some crazy-routing for pretty urls.
url = request.parameters => {"action"=>"index",
"id"=>"21",
"controller"=>"video"}
then, I would do this.
redirect_to(:controller => "video")
The url it redirects to is...
"video/index/21"
While, I would expect (and the previous behaviour was)..
"video"
Am I crazy?
-hampton.
That means its understanding the deletion of the :do directive, but is
keeping the :id and :action around.
On 6/1/06, Jamis Buck <jamis@37signals.com> wrote:>
> Just a quick update--the routing rewrite has been checked in.
We''ve
> already noticed a few things broken and have patching them this
> morning, but we''d love to hear from those of you willing to test
> their apps with the bleeding edge.
>
> Thanks!
>
> - Jamis
> _______________________________________________
> Rails-core mailing list
> Rails-core@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-core
>
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core
You need to set the id or action to nil, unless you change the controller to something else than video it will include all the params... try redirect_to(:controller => "video", :action => nil) -- Abdul Hampton wrote:> I have an application that broke. > > This may be an unwanted behaviour, or not, but I was working with this > as a feature for using some crazy-routing for pretty urls. > > url = request.parameters => {"action"=>"index", "id"=>"21", > "controller"=>"video"} > > then, I would do this. > > redirect_to(:controller => "video") > > The url it redirects to is... > > "video/index/21" > > While, I would expect (and the previous behaviour was).. > > "video" > > Am I crazy? > > -hampton. > > That means its understanding the deletion of the :do directive, but is > keeping the :id and :action around. > > On 6/1/06, *Jamis Buck* <jamis@37signals.com > <mailto:jamis@37signals.com>> wrote: > > Just a quick update--the routing rewrite has been checked in. We''ve > already noticed a few things broken and have patching them this > morning, but we''d love to hear from those of you willing to test > their apps with the bleeding edge. > > Thanks! > > - Jamis > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > <mailto:Rails-core@lists.rubyonrails.org> > http://lists.rubyonrails.org/mailman/listinfo/rails-core > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core >
btw, the default way of doing this would be redirect_to(:action => ''index'') Abdur-Rahman Advany wrote:> You need to set the id or action to nil, unless you change the > controller to something else than video it will include all the params... > > try redirect_to(:controller => "video", :action => nil) > > -- Abdul > > Hampton wrote: >> I have an application that broke. >> >> This may be an unwanted behaviour, or not, but I was working with >> this as a feature for using some crazy-routing for pretty urls. >> >> url = request.parameters => {"action"=>"index", "id"=>"21", >> "controller"=>"video"} >> >> then, I would do this. >> >> redirect_to(:controller => "video") >> >> The url it redirects to is... >> >> "video/index/21" >> >> While, I would expect (and the previous behaviour was).. >> >> "video" >> >> Am I crazy? >> >> -hampton. >> >> That means its understanding the deletion of the :do directive, but >> is keeping the :id and :action around. >> >> On 6/1/06, *Jamis Buck* <jamis@37signals.com >> <mailto:jamis@37signals.com>> wrote: >> >> Just a quick update--the routing rewrite has been checked in. We''ve >> already noticed a few things broken and have patching them this >> morning, but we''d love to hear from those of you willing to test >> their apps with the bleeding edge. >> >> Thanks! >> >> - Jamis >> _______________________________________________ >> Rails-core mailing list >> Rails-core@lists.rubyonrails.org >> <mailto:Rails-core@lists.rubyonrails.org> >> http://lists.rubyonrails.org/mailman/listinfo/rails-core >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Rails-core mailing list >> Rails-core@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-core >> > > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core >
Oops... common way of doing it would be redirect_to(:id => nil) Abdur-Rahman Advany wrote:> btw, the default way of doing this would be redirect_to(:action => > ''index'') > > Abdur-Rahman Advany wrote: >> You need to set the id or action to nil, unless you change the >> controller to something else than video it will include all the >> params... >> >> try redirect_to(:controller => "video", :action => nil) >> >> -- Abdul >> >> Hampton wrote: >>> I have an application that broke. >>> >>> This may be an unwanted behaviour, or not, but I was working with >>> this as a feature for using some crazy-routing for pretty urls. >>> >>> url = request.parameters => {"action"=>"index", "id"=>"21", >>> "controller"=>"video"} >>> >>> then, I would do this. >>> >>> redirect_to(:controller => "video") >>> >>> The url it redirects to is... >>> >>> "video/index/21" >>> >>> While, I would expect (and the previous behaviour was).. >>> >>> "video" >>> >>> Am I crazy? >>> >>> -hampton. >>> >>> That means its understanding the deletion of the :do directive, but >>> is keeping the :id and :action around. >>> >>> On 6/1/06, *Jamis Buck* <jamis@37signals.com >>> <mailto:jamis@37signals.com>> wrote: >>> >>> Just a quick update--the routing rewrite has been checked in. We''ve >>> already noticed a few things broken and have patching them this >>> morning, but we''d love to hear from those of you willing to test >>> their apps with the bleeding edge. >>> >>> Thanks! >>> >>> - Jamis >>> _______________________________________________ >>> Rails-core mailing list >>> Rails-core@lists.rubyonrails.org >>> <mailto:Rails-core@lists.rubyonrails.org> >>> http://lists.rubyonrails.org/mailman/listinfo/rails-core >>> >>> >>> ------------------------------------------------------------------------ >>> >>> >>> _______________________________________________ >>> Rails-core mailing list >>> Rails-core@lists.rubyonrails.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails-core >>> >> >> _______________________________________________ >> Rails-core mailing list >> Rails-core@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-core >> > > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core >
Let me give you a more full example of what changes after the upgrade. I
fully acknowledge this is a hackish way to keep a pretty URL. Whether this
is the Best Way doesn''t really matter. What should matter is that this
breaks applications.
Routing in question:
map.connect '':controller/:page_number'',
:requirements => { :page_number => (/^[0-9]+$/) }
We start on a page with the url
{"action"=>"index", "id"=>"21",
"controller"=>"video"}
or
/video/index/21
Then, during the rendering of this page, url_for is called as...
url_for(:page_number => 3)
As of revision 4340ish, this would translate into (good thing in my
application!)
"/video/3"
As of the current revision, this translates into
"/video/3?id=21"
Certainly I can re-code things to work with the new revision, but if
backwards compatibility is important then this shouldn''t happen.
-hampton.
On 6/1/06, Abdur-Rahman Advany <rails@advany.com>
wrote:>
> You need to set the id or action to nil, unless you change the
> controller to something else than video it will include all the params...
>
> try redirect_to(:controller => "video", :action => nil)
>
> -- Abdul
>
> Hampton wrote:
> > I have an application that broke.
> >
> > This may be an unwanted behaviour, or not, but I was working with this
> > as a feature for using some crazy-routing for pretty urls.
> >
> > url = request.parameters =>
{"action"=>"index", "id"=>"21",
> > "controller"=>"video"}
> >
> > then, I would do this.
> >
> > redirect_to(:controller => "video")
> >
> > The url it redirects to is...
> >
> > "video/index/21"
> >
> > While, I would expect (and the previous behaviour was)..
> >
> > "video"
> >
> > Am I crazy?
> >
> > -hampton.
> >
> > That means its understanding the deletion of the :do directive, but is
> > keeping the :id and :action around.
> >
> > On 6/1/06, *Jamis Buck* <jamis@37signals.com
> > <mailto:jamis@37signals.com>> wrote:
> >
> > Just a quick update--the routing rewrite has been checked in.
We''ve
> > already noticed a few things broken and have patching them this
> > morning, but we''d love to hear from those of you willing
to test
> > their apps with the bleeding edge.
> >
> > Thanks!
> >
> > - Jamis
> > _______________________________________________
> > Rails-core mailing list
> > Rails-core@lists.rubyonrails.org
> > <mailto:Rails-core@lists.rubyonrails.org>
> > http://lists.rubyonrails.org/mailman/listinfo/rails-core
> >
> >
> >
------------------------------------------------------------------------
> >
> > _______________________________________________
> > Rails-core mailing list
> > Rails-core@lists.rubyonrails.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails-core
> >
>
> _______________________________________________
> Rails-core mailing list
> Rails-core@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-core
>
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core
Further: I was trying to fix my code to use the nil method, and here was the result: url_for(:page_number => 3, :id => nil) "/video/2?id=" That''s definitely not the desired behaviour. -hampton. On 6/1/06, Hampton <hcatlin@gmail.com> wrote:> > Let me give you a more full example of what changes after the upgrade. I > fully acknowledge this is a hackish way to keep a pretty URL. Whether this > is the Best Way doesn''t really matter. What should matter is that this > breaks applications. > > Routing in question: > > map.connect '':controller/:page_number'', > :requirements => { :page_number => (/^[0-9]+$/) } > > We start on a page with the url > > {"action"=>"index", "id"=>"21", "controller"=>"video"} > or > /video/index/21 > > Then, during the rendering of this page, url_for is called as... > > url_for(:page_number => 3) > > As of revision 4340ish, this would translate into (good thing in my > application!) > > "/video/3" > > As of the current revision, this translates into > > "/video/3?id=21" > > Certainly I can re-code things to work with the new revision, but if > backwards compatibility is important then this shouldn''t happen. > > -hampton. > > >_______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core
hi
this seems to give issues:
simply doing,
def helper_routes
with_routing do |set|
set.draw { set.connect '':controller/:action/:id'' }
[..]
end
end
throws
NoMethodError: undefined method `connect'' for
#<ActionController::Routing::RouteSet:0x2346860>
i don''t quite get why since RouteSet#draw simply yields to Mapper
which does connect.
rodney
I don''t understand why using the helper
On 6/1/06, Abdur-Rahman Advany <rails@advany.com>
wrote:> Oops... common way of doing it would be redirect_to(:id => nil)
>
> Abdur-Rahman Advany wrote:
> > btw, the default way of doing this would be redirect_to(:action =>
> > ''index'')
> >
> > Abdur-Rahman Advany wrote:
> >> You need to set the id or action to nil, unless you change the
> >> controller to something else than video it will include all the
> >> params...
> >>
> >> try redirect_to(:controller => "video", :action =>
nil)
> >>
> >> -- Abdul
> >>
> >> Hampton wrote:
> >>> I have an application that broke.
> >>>
> >>> This may be an unwanted behaviour, or not, but I was working
with
> >>> this as a feature for using some crazy-routing for pretty
urls.
> >>>
> >>> url = request.parameters =>
{"action"=>"index", "id"=>"21",
> >>> "controller"=>"video"}
> >>>
> >>> then, I would do this.
> >>>
> >>> redirect_to(:controller => "video")
> >>>
> >>> The url it redirects to is...
> >>>
> >>> "video/index/21"
> >>>
> >>> While, I would expect (and the previous behaviour was)..
> >>>
> >>> "video"
> >>>
> >>> Am I crazy?
> >>>
> >>> -hampton.
> >>>
> >>> That means its understanding the deletion of the :do
directive, but
> >>> is keeping the :id and :action around.
> >>>
> >>> On 6/1/06, *Jamis Buck* <jamis@37signals.com
> >>> <mailto:jamis@37signals.com>> wrote:
> >>>
> >>> Just a quick update--the routing rewrite has been checked
in. We''ve
> >>> already noticed a few things broken and have patching them
this
> >>> morning, but we''d love to hear from those of you
willing to test
> >>> their apps with the bleeding edge.
> >>>
> >>> Thanks!
> >>>
> >>> - Jamis
> >>> _______________________________________________
> >>> Rails-core mailing list
> >>> Rails-core@lists.rubyonrails.org
> >>> <mailto:Rails-core@lists.rubyonrails.org>
> >>> http://lists.rubyonrails.org/mailman/listinfo/rails-core
> >>>
> >>>
> >>>
------------------------------------------------------------------------
> >>>
> >>>
> >>> _______________________________________________
> >>> Rails-core mailing list
> >>> Rails-core@lists.rubyonrails.org
> >>> http://lists.rubyonrails.org/mailman/listinfo/rails-core
> >>>
> >>
> >> _______________________________________________
> >> Rails-core mailing list
> >> Rails-core@lists.rubyonrails.org
> >> http://lists.rubyonrails.org/mailman/listinfo/rails-core
> >>
> >
> > _______________________________________________
> > Rails-core mailing list
> > Rails-core@lists.rubyonrails.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails-core
> >
>
> _______________________________________________
> Rails-core mailing list
> Rails-core@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-core
>
--
Rodney
http://www.pinupgeek.com
http://www.dutchrailers.org
On Jun 1, 2006, at 12:04 PM, Rodney Ramdas wrote:> hi > > this seems to give issues: > > simply doing, > > def helper_routes > with_routing do |set| > set.draw { set.connect '':controller/:action/:id'' } > [..] > end > end > > throws > > NoMethodError: undefined method `connect'' for > #<ActionController::Routing::RouteSet:0x2346860> > > i don''t quite get why since RouteSet#draw simply yields to Mapper > which does connect.Use the map that set.draw yields: with_routing do |set| set.draw do |map| map.connect '':controller/:action/:id'' end end jeremy
that works, tnx :-) On 6/1/06, Jeremy Kemper <jeremy@bitsweat.net> wrote:> On Jun 1, 2006, at 12:04 PM, Rodney Ramdas wrote: > > hi > > > > this seems to give issues: > > > > simply doing, > > > > def helper_routes > > with_routing do |set| > > set.draw { set.connect '':controller/:action/:id'' } > > [..] > > end > > end > > > > throws > > > > NoMethodError: undefined method `connect'' for > > #<ActionController::Routing::RouteSet:0x2346860> > > > > i don''t quite get why since RouteSet#draw simply yields to Mapper > > which does connect. > > Use the map that set.draw yields: > > with_routing do |set| > set.draw do |map| > map.connect '':controller/:action/:id'' > end > end > > jeremy >-- Rodney http://www.pinupgeek.com http://www.dutchrailers.org
On 6/1/06, Jamis Buck <jamis@37signals.com> wrote:> Just a quick update--the routing rewrite has been checked in. We''ve > already noticed a few things broken and have patching them this > morning, but we''d love to hear from those of you willing to test > their apps with the bleeding edge. > > Thanks! > > - JamisI tried this on a client app that uses Simply Restful and got a lot of errors (after updating the plugin and changing my delete methods to destroy). Mephisto also got a fair amount of errors as well. I''ll do what I can to investigate and fix the bugs though. Gives me a chance to get acquainted with the new code and hopefully get some more routing regression tests added. I wrote up a little routing navigator if anyone needs some help debugging routes: http://rpaste.com/pastes/198 You can pretty much dump that in any view directory and run it without touching the controller. -- Rick Olson http://techno-weenie.net
Hampton, Thanks for your testing on this. It does appear that :id, at least, is extra sticky now. We''ll see what can be done with this, since it should definitely not be acting so zealous. - Jamis On Jun 1, 2006, at 12:58 PM, Hampton wrote:> Further: > > I was trying to fix my code to use the nil method, and here was the > result: > > url_for(:page_number => 3, :id => nil) > > "/video/2?id=" > > That''s definitely not the desired behaviour. > > -hampton. > > On 6/1/06, Hampton <hcatlin@gmail.com> wrote: > Let me give you a more full example of what changes after the > upgrade. I fully acknowledge this is a hackish way to keep a > pretty URL. Whether this is the Best Way doesn''t really matter. > What should matter is that this breaks applications. > > Routing in question: > > map.connect '':controller/:page_number'', > :requirements => { :page_number => (/^[0-9]+$/) } > > We start on a page with the url > > {"action"=>"index", "id"=>"21", "controller"=>"video"} > or > /video/index/21 > > Then, during the rendering of this page, url_for is called as... > > url_for(:page_number => 3) > > As of revision 4340ish, this would translate into (good thing in my > application!) > > "/video/3" > > As of the current revision, this translates into > > "/video/3?id=21" > > Certainly I can re-code things to work with the new revision, but > if backwards compatibility is important then this shouldn''t happen. > > -hampton. > > > > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core
On 2-jun-2006, at 7:57, Jamis Buck wrote:> Hampton, > > Thanks for your testing on this. It does appear that :id, at least, > is extra sticky now. We''ll see what can be done with this, since it > should definitely not be acting so zealous.Jamis, can something be done to disambiguiate where a leadig slash is necessary and where not? (both in routes and in url_for). After this rewrite I get some weird routing changes, for instance such a route: map.connect ''about'', :controller => "welcome", :action=>"about" would before connect to ''about'' from everywhere - now it does so only from my index action of the controller, and from the others it gives ''/welcome/about'' Not pretty :-( -- Julian ''Julik'' Tarkhanov please send all personal mail to me at julik.nl
On 3-jun-2006, at 5:00, Julian ''Julik'' Tarkhanov wrote:> > On 2-jun-2006, at 7:57, Jamis Buck wrote: > >> Hampton, >> >> Thanks for your testing on this. It does appear that :id, at >> least, is extra sticky now. We''ll see what can be done with this, >> since it should definitely not be acting so zealous. > > Jamis, can something be done to disambiguiate where a leadig slash > is necessary and where not? (both in routes and in url_for). After > this rewrite I get some weird routing changes, for instance such a > route: > > map.connect ''about'', :controller => "welcome", :action=>"about" > > would before connect to > > ''about'' from everywhere - now it does so only from my index action > of the controller, and from the others it gives > > ''/welcome/about'' > > Not pretty :-(and it happens from the actions that use the :id parameter. Sticky, indeed. -- Julian ''Julik'' Tarkhanov please send all personal mail to me at julik.nl