Method: ActionController::API.without_modules

Defined in:
actionpack/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(: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.



107
108
109
110
111
112
113
# File 'actionpack/lib/action_controller/api.rb', line 107

def self.without_modules(*modules)
  modules = modules.map do |m|
    m.is_a?(Symbol) ? ActionController.const_get(m) : m
  end

  MODULES - modules
end