Method: ActionController::API.without_modules
- Defined in:
- lib/action_controller/api.rb
.without_modules(*modules) ⇒ Object
Shortcut helper that returns all the ActionController::API modules except the ones passed as arguments:
class MyAPIBaseController < ActionController::Metal
ActionController::API.without_modules(:ForceSSL, :UrlFor).each do |left|
include left
end
end
This gives better control over what you want to exclude and makes it easier to create an API controller class, instead of listing the modules required manually.
102 103 104 105 106 107 108 |
# File 'lib/action_controller/api.rb', line 102 def self.without_modules(*modules) modules = modules.map do |m| m.is_a?(Symbol) ? ActionController.const_get(m) : m end MODULES - modules end |