Topic: Exit action

How do I exit/stop an action?

Re: Exit action

You mean, like, if you want to keep the stuff in the rest of the action from executing?  You've got two ways:

1) use an if..else:

def create
  if params[:id]
    # do your stuff
  else
    # other stuff you don't want to happen normally
  end
end

2) just 'return'
def create
  # do your stuff
  return
  # the code never gets here!
end

Re: Exit action

Perfect. Thanks.