Private Actions that have Views aren't that private

Hello

If a certain action in a certain controller is private it should
return an “Unknown action” error if you type its path in the browser.
But if it has a corresponding view, the browser actually shows the
view. Why is that so?

On 8 Oct 2007, at 00:05, Onildo wrote:

Hello

If a certain action in a certain controller is private it should
return an “Unknown action” error if you type its path in the browser.
But if it has a corresponding view, the browser actually shows the
view. Why is that so?

Because ActionController basically does

if self.class.public_methods.include?(method)
#perform the action
elsif template_exists?(method)
#render template
else
raise ‘Unknown action’
end

Fred

Yup. This is also true if there’s a template without a controller
method either.

–Jeremy

On 10/7/07, Onildo [email protected] wrote:


http://www.jeremymcanally.com/

My books:
Ruby in Practice

My free Ruby e-book
http://www.humblelittlerubybook.com/

My blogs:
http://www.mrneighborly.com/
http://www.rubyinpractice.com/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs