Sha256: 1dcecd21689223e0246734b9eb12d931ab7626fdb0378ca4162bc54380641eb2

Contents?: true

Size: 1.57 KB

Versions: 2

Compression:

Stored size: 1.57 KB

Contents

module ActiveScaffoldBatch
  class Engine < ::Rails::Engine
    initializer 'active_scaffold_batch.routes' do
      ActiveSupport.on_load :active_scaffold_routing do
        self::ACTIVE_SCAFFOLD_CORE_ROUTING[:collection][:batch_edit] = :get
        self::ACTIVE_SCAFFOLD_CORE_ROUTING[:collection][:batch_update] = :post
        self::ACTIVE_SCAFFOLD_CORE_ROUTING[:collection][:batch_new] = :get
        self::ACTIVE_SCAFFOLD_CORE_ROUTING[:collection][:batch_create] = :post
        self::ACTIVE_SCAFFOLD_CORE_ROUTING[:collection][:batch_add] = :get
        #not working because routing picks show route instead
        #self::ACTIVE_SCAFFOLD_CORE_ROUTING[:collection][:batch_destroy] = :get
        #you may define a route for your controller before resource routes
        #match 'players/batch_destroy' => 'players#batch_destroy', :via => [:get]
        self::ACTIVE_SCAFFOLD_CORE_ROUTING[:collection][:batch_destroy] = :delete
      end
    end

    initializer("active_scaffold_batch.view") do
      ActiveSupport.on_load(:action_view) do
        begin
          include ActiveScaffold::Helpers::UpdateColumnHelpers
          if ActiveScaffold.js_framework == :jquery
            include ActiveScaffold::Helpers::DatepickerUpdateColumnHelpers
          elsif ActiveScaffold.js_framework == :prototype
            include ActiveScaffold::Helpers::CalendarDateSelectUpdateColumnHelpers if defined? CalendarDateSelect
          end
          include ActiveScaffold::Helpers::BatchCreateColumnHelpers
        rescue
          raise $! unless Rails.env == 'production'
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_scaffold_batch-3.5.2 lib/active_scaffold_batch/engine.rb
active_scaffold_batch-3.5.1 lib/active_scaffold_batch/engine.rb