Class: ActiveScaffold::Config::Form

Inherits:
Base show all
Defined in:
lib/active_scaffold/config/form.rb

Direct Known Subclasses

Create, Update

Instance Attribute Summary collapse

Attributes inherited from Base

#action_group, #core, #user

Instance Method Summary collapse

Methods inherited from Base

#crud_type, #formats, #formats=, inherited

Methods included from ActiveScaffold::Configurable

#configure, #method_missing

Constructor Details

#initialize(core_config) ⇒ Form

Returns a new instance of Form.



3
4
5
6
7
# File 'lib/active_scaffold/config/form.rb', line 3

def initialize(core_config)
  super
  # no global setting here because multipart should only be set for specific forms
  @multipart = false
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveScaffold::Configurable

Instance Attribute Details

#labelObject



20
21
22
# File 'lib/active_scaffold/config/form.rb', line 20

def label
  as_(@label)
end

the ActionLink for this action



16
17
18
# File 'lib/active_scaffold/config/form.rb', line 16

def link
  @link
end

#multipart=(value) ⇒ Object (writeonly)

whether the form should be multipart



37
38
39
# File 'lib/active_scaffold/config/form.rb', line 37

def multipart=(value)
  @multipart = value
end

Instance Method Details

#columnsObject

provides access to the list of columns specifically meant for the Form to use



25
26
27
28
29
30
31
32
# File 'lib/active_scaffold/config/form.rb', line 25

def columns
  unless @columns # lazy evaluation
    self.columns = @core.columns._inheritable
    self.columns.exclude :created_on, :created_at, :updated_on, :updated_at, :marked
    self.columns.exclude *@core.columns.collect{|c| c.name if c.polymorphic_association?}.compact
  end
  @columns
end

#multipart?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/active_scaffold/config/form.rb', line 38

def multipart?
  @multipart ? true : false
end