Class: ActiveScaffold::Config::BatchCreate

Inherits:
Form
  • Object
show all
Defined in:
lib/active_scaffold/config/batch_create.rb

Constant Summary collapse

ActiveScaffold::DataStructures::ActionLink.new('batch_new', :label => :create, :type => :collection, :security_method => :batch_create_authorized?, :ignore_method => :batch_create_ignore?)
@@plugin_directory =
File.expand_path(__FILE__).match(%{(^.*)/lib/active_scaffold/config/batch_create.rb})[1]
@@process_mode =
:create
@@list_mode_enabled =
true

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ BatchCreate

Returns a new instance of BatchCreate.



4
5
6
7
8
9
# File 'lib/active_scaffold/config/batch_create.rb', line 4

def initialize(*args)
  super
  @process_mode = self.class.process_mode
  @action_group ||= 'collection.batch'
  @list_mode_enabled = self.class.list_mode_enabled
end

Instance Attribute Details

#default_batch_by_columnObject

you may use create_batch to create a record for each record of a belong_to association (reverse must be has_many) eg. player belongs to team you may batch create a player records for a list of teams



48
49
50
# File 'lib/active_scaffold/config/batch_create.rb', line 48

def default_batch_by_column
  @default_batch_by_column
end

#list_mode_enabledObject

Returns the value of attribute list_mode_enabled.



42
43
44
# File 'lib/active_scaffold/config/batch_create.rb', line 42

def list_mode_enabled
  @list_mode_enabled
end

#process_modeObject

see class accessor



40
41
42
# File 'lib/active_scaffold/config/batch_create.rb', line 40

def process_mode
  @process_mode
end

Class Method Details

global level configuration


the ActionLink for this action



14
15
16
# File 'lib/active_scaffold/config/batch_create.rb', line 14

def self.link
  @@link
end

.link=(val) ⇒ Object



17
18
19
# File 'lib/active_scaffold/config/batch_create.rb', line 17

def self.link=(val)
  @@link = val
end

Instance Method Details

#label(model = nil) ⇒ Object

the label= method already exists in the Form base class



52
53
54
55
# File 'lib/active_scaffold/config/batch_create.rb', line 52

def label(model = nil)
  model ||= @core.label(:count => 2)
  @label ? as_(@label) : as_(:create_model, :model => model)
end