class AbstractController::Base

def controller_path

* String
==== Returns

MyApp::MyPostsController.controller_path # => "my_app/my_posts"

end

class MyApp::MyPostsController < AbstractController::Base

Returns the full controller name, underscored, without the ending Controller.
def controller_path
  @controller_path ||= name.delete_suffix("Controller").underscore unless anonymous?
end