class method
self.controller_name
Ruby on Rails 3.1.12
Since v3.0.20Signature
self.controller_name()
Returns the last part of the controller’s name, underscored, without the ending Controller. For instance, PostsController returns posts. Namespaces are left out, so Admin::PostsController returns posts as well.
Returns
-
string
Source
# File actionpack/lib/action_controller/metal.rb, line 116
def self.controller_name
@controller_name ||= self.name.demodulize.sub(/Controller$/, '').underscore
end
Defined in actionpack/lib/action_controller/metal.rb line 116
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionController::Metal