Sha256: 9dd8e3c48aab06500f739bc5694ceee92abd386621f125b276f945f2d4649d42

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

module ActiveScaffoldBatch
  class Engine < ::Rails::Engine
    initializer("initialize_active_scaffold_batch", :after => "initialize_active_scaffold") do
      initializer 'active_scaffold_export.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

      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

1 entries across 1 versions & 1 rubygems

Version Path
active_scaffold_batch-3.5.0 lib/active_scaffold_batch/engine.rb