How to stop a rails controller from executing?

I have the following piece of code

def show
    unless logged_in?
      login_required
      return
    end
    #some additional code
    #that should only execute
    #if user is logged in
end

This works perfectly. Now I'd like to move the login check into a before filter. The problem is, that when I return from a method outside of show, it doesn't stop the execution of show... how do i stop show from going through with the code from an external method (i.e. one that could be called from a before filter)?

Thanks!

20
задан Yuval Karmi 4 September 2010 в 07:04
поделиться