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(: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.



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

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

  MODULES - modules
end