[Rails-core] link_to should have its body and url arguments reversed

2013-03-15 Thread Michael Grohn
I think the link_to helper method is quite confusing with its arguments order: link_to body, url link_to "Click me", @person Why is it thay way round? I want to make a "link to [the] person", so I would expect the order to be: link_to @person, "Click me" It reads much more natural

[Rails-core] Controller test session issue when using render

2013-03-15 Thread Fabio Kreusch
I'm using Rails 3.2.12, and I have a spec similar to this: # Spec before do post :create end it { session[:order_id].should be_nil } # Controller def create ... session[:order_id] = nil end Now, that spec passes/fails depending on the controller redirecting or rendering: Passes: redi

Re: [Rails-core] link_to should have its body and url arguments reversed

2013-03-15 Thread Luís Ferreira
A less destructive approach would be to use Ruby 2.0's named arguments to have something like: link_to url: @person, body: "Click me" That being said, I understand your point, but don't see it as a particular pain. On Mar 15, 2013, at 12:58 PM, Michael Grohn wrote: > I think the link_to helper

Re: [Rails-core] link_to should have its body and url arguments reversed

2013-03-15 Thread Matt Jones
On Mar 15, 2013, at 8:58 AM, Michael Grohn wrote: > I think the link_to helper method is quite confusing with its arguments order: > > link_to body, url > link_to "Click me", @person > > Why is it thay way round? I want to make a "link to [the] person", so I would > expect the order to

Re: [Rails-core] link_to should have its body and url arguments reversed

2013-03-15 Thread Michael Grohn
@Matt jones > I'd guess that it's because while the body is typically simple (a string or variable), the second argument can also be a bunch of params for url_for: > > link_to 'thingy', :controller => 'wat', :action => 'huh', :protocol => 'wtf' There are 4 signatures for the link_to helper

Re: [Rails-core] link_to should have its body and url arguments reversed

2013-03-15 Thread Andrés Mejía
You can always use link_to @person { "Click me" } if you find that infinitely more readable than link_to "Click me", @person without the need to introduce a backwards incompatible change that would break every Rails app ever written. On Fri, Mar 15, 2013 at 3:39 PM, Michael Grohn wrote: > @M

Re: [Rails-core] link_to should have its body and url arguments reversed

2013-03-15 Thread Matt Jones
On Mar 15, 2013, at 2:39 PM, Michael Grohn wrote: > @Matt jones > > > I'd guess that it's because while the body is typically simple (a string or > > variable), the second argument can also be a bunch of params for url_for: > > > > link_to 'thingy', :controller => 'wat', :action => 'huh', :pr