Class: ActionController::Resources::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb

Constant Summary collapse

ACTIVE_SCAFFOLD_ROUTING =
{
  :collection => {:show_search => :get, :update_table => :get, :edit_associated => :get, :list => :get, :new_existing => :get, :add_existing => :post, :render_field => :get, :print_list => :get, :show_customize => :get, :show_export_tool => :get, :reset_search => :get, :refresh => :get, :reset_customize => :get, :customize => :get, :export_tool => :get},
  :member => {:row => :get, :nested => :get, :edit_associated => :get, :add_association => :get, :update_column => :post, :destroy_existing => :delete, :render_field => :get, :delete => :get}
}

Instance Method Summary collapse

Instance Method Details

#loggerObject



22
23
24
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb', line 22

def logger
  ActionController::Base::logger
end

#options_with_active_scaffoldObject

by overwriting the attr_reader :options, we can parse out a special :active_scaffold flag just-in-time.



10
11
12
13
14
15
16
17
18
19
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/resources.rb', line 10

def options_with_active_scaffold
  if @options.delete :active_scaffold
    logger.info "ActiveScaffold: extending RESTful routes for #{@plural}"
    @options[:collection] ||= {}
    @options[:collection].merge! ACTIVE_SCAFFOLD_ROUTING[:collection]
    @options[:member] ||= {}
    @options[:member].merge! ACTIVE_SCAFFOLD_ROUTING[:member]
  end
  options_without_active_scaffold
end