On Sun, Jan 13, 2013 at 9:17 AM, Jordon Bedwell <[email protected]> wrote:
> MyController < ApplicationController
>   def my_action
>      redirect_to :back unless params["blah"] == "blah"
>      render :my_template
>   end
> end
>
> Should be:
>
> MyController < ApplicationController
>   def my_action
>      return redirect_to :back unless params["blah"] == "blah"
>      render :my_template
>   end
> end

To add before somebody points it out, I would never personally write a
simple method like that, I would instead prefer to do something like:

MyController < ApplicationController
  def my_action
    prams["blah"] == "blah" ? render(:my_template) : redirect_to(:back)
  end
end

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to