Forum: Ruby on Rails render (:action => 'xyz') in a private controller method

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2006-04-17 22:04
All,

I have a controller method (A) which gets called and then delegates some
validation to a private validation method (B).  This method in turn
attempts to call

render(:action => 'xyz')

in order to pass control back to the view upon an exception condition.

However, it simply completes the method B and returns control to A.

So, I take it that render only works inside of a controller method that
is directly invoked based on a HTTP request?

I guess I can throw exceptions in my private method (B) up to my public
controller method (A) and then handle them there?

Is that the preferred way to handle this?

Thanks,
Wes
This topic is locked and can not be replied to.