Retrieve the current controller name from a view

Hi all, I wonder if it’s possible to retrieve the current controller
name and possibly the action when you’re in a view.

i.e. I call the same template/partial view from different controllers
and I’d like to know when I’m in the view code which controller is
calling it…

Any ideas? Sorry if it’s obvious but I couldn’t find it in the doc.


<%= controller.controller_name -%>
<%= controller.action_name -%>

On 5/15/06, Gael P. [email protected] wrote:

Rails mailing list
[email protected]

Thanks, I knew it would be that simple…

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