I would like access to the page name from within a page. For example if the page was “somesite/contact” I would like to get “contact”. If it was “somesite/signup” I would get “signup” etc.
Obviously I could strip this out of the pages URL using request.fullpath and some RegeX, but there must be a more object-oriented way of getting it?
If you’re in the view, call
controller.action_name. If you’re in the controller, simply callaction_name. This assumes a RESTful design.