On Nov 19, 11:27 pm, candlerb <b.cand...@pobox.com> wrote:
> > Why do you need to terminate a request early?  Is this an HTTP request?
>
> By "request" I meant "controller action".
>
> Within a method called by the controller action, I want to render
> something and then prevent the controller action from continuing any
> further (otherwise I'd get a double-render error, and/or the
> controller would make changes to the database state which I don't want
> it to).
>
> I am aware of before_filter. but in this case I will have gone quite a
> long way into the controller action logic before it's known that I
> need to terminate this particular request. It doesn't divide neatly
> into "pre-condition check" and then "do stuff".
>
> I thought I had seen somewhere that there was a way to terminate a
> request early, but I could be thinking of a different framework. In
> Sinatra you can 'throw :halt, response'.

Just return. Actions are normal Ruby methods. E.g:

return redirect_to(users_path)

//jarkko

--

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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=.


Reply via email to