Module: ResourceMapper::Controller

Defined in:
lib/resource_mapper/controller.rb

Class Method Summary collapse

Class Method Details

.included(subclass) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/resource_mapper/controller.rb', line 3

def self.included(subclass)
  subclass.class_eval do
    include ResourceMapper::Helpers
    include ResourceMapper::Actions
    extend  ResourceMapper::Accessors
    extend  ResourceMapper::ClassMethods

    class_reader_writer :belongs_to, *NAME_ACCESSORS
    NAME_ACCESSORS.each { |accessor| send(accessor, controller_name.singularize.underscore) }

    ACTIONS.each do |action|
      class_scoping_reader action, FAILABLE_ACTIONS.include?(action) ? ResourceMapper::FailableActionOptions.new : ResourceMapper::ActionOptions.new
    end
  end

  init_default_actions(subclass)
end