Method: ActionController::Base.without_modules
- Defined in:
- actionpack/lib/action_controller/base.rb
.without_modules(*modules) ⇒ Object
Shortcut helper that returns all the modules included in ActionController::Base except the ones passed as arguments:
class MyBaseController < ActionController::Metal
ActionController::Base.without_modules(:ParamsWrapper, :Streaming).each do |left|
include left
end
end
This gives better control over what you want to exclude and makes it easier to create a bare controller class, instead of listing the modules required manually.
222 223 224 225 226 227 228 |
# File 'actionpack/lib/action_controller/base.rb', line 222 def self.without_modules(*modules) modules = modules.map do |m| m.is_a?(Symbol) ? ActionController.const_get(m) : m end MODULES - modules end |