Categories
Programming

How to get the current action & controller name in Rails

In your views:

controller.action_name
controller.controller_name

In the controller itself, you can just call

controller_name
action_name

If you want the current URI, try:

request.request_uri

Leave a Reply

OR LOG IN WITH




Your email address will not be published. Required fields are marked *