From: Brian Candler Date: 2010-09-29T05:55:35+09:00 Subject: Re: puts and return Jim Haungs wrote: > One sees control code like this in rails all the time: > > redirect_to and return if Presumably that's in someone else's Rails application, not in Rails itself. That line is horrible. Firstly it's too clever, relying on relative operator precedence between 'and' and 'if' which nobody remembers. And secondly, it would break if there were ever a condition where redirect_to did return false or nil(*). But I understand the need for this pattern. I use this instead: return redirect_to() if Regards, Brian. (*) IMO this is very dangerous, given that redirect_to doesn't even have a documented return value: http://api.rubyonrails.org/classes/ActionController/Redirecting.html#method-i-redirect_to Looking at the source, the return value happens to be the body HTML string. Today. -- Posted via http://www.ruby-forum.com/.