Method: AbstractController::Base.controller_path

Defined in:
actionpack/lib/abstract_controller/base.rb

.controller_pathObject

Returns the full controller name, underscored, without the ending Controller.

class MyApp::MyPostsController < AbstractController::Base

end

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

#### Returns

  • String



127
128
129
# File 'actionpack/lib/abstract_controller/base.rb', line 127

def controller_path
  @controller_path ||= name.delete_suffix("Controller").underscore unless anonymous?
end