Sha256: 865a223164026c44de15859bc1d77f2f5e29782efbb92b38ed1efec50cab2bd4

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

module ActiveScaffold::Config
  class BatchUpdate < ActiveScaffold::Config::Form
    self.crud_type = :update
    def initialize(*args)
      super
      @process_mode = self.class.process_mode
      @action_group ||= 'collection.batch'
    end

    # global level configuration
    # --------------------------
    # the ActionLink for this action
    def self.link
      @@link
    end
    def self.link=(val)
      @@link = val
    end
    @@link = ActiveScaffold::DataStructures::ActionLink.new('batch_edit', :label => :edit, :type => :collection, :security_method => :batch_update_authorized?)

    # configures where the plugin itself is located. there is no instance version of this.
    cattr_accessor :plugin_directory
    @@plugin_directory = File.expand_path(__FILE__).match(/vendor\/plugins\/([^\/]*)/)[1]

    # configures how batch updates should be processed
    # :update => standard activerecord update including validations
    # :update_all => updating in one sql call without activerecord instantiation and validation
    cattr_accessor :process_mode
    @@process_mode = :update


    # instance-level configuration
    # ----------------------------

    # see class accessor
    attr_accessor :process_mode


    # the label= method already exists in the Form base class
    def label(model = nil)
      model ||= @core.label(:count => 2)
      @label ? as_(@label) : as_(:update_model, :model => model)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_scaffold_batch_vho-3.0.0 lib/active_scaffold/config/batch_update.rb