Class: ActiveScaffold::Config::Subform

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

Constant Summary collapse

@@layout =
:horizontal

Instance Attribute Summary collapse

Attributes inherited from Base

#action_group, #user

Instance Method Summary collapse

Methods inherited from Base

#crud_type, #formats, #formats=, inherited, #label

Methods included from ActiveScaffold::Configurable

#configure, #method_missing

Constructor Details

#initialize(core_config) ⇒ Subform

Returns a new instance of Subform.



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

def initialize(core_config)
  super
  @layout = self.class.layout # default layout
end

Dynamic Method Handling

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

Instance Attribute Details

#layoutObject

instance-level configuration




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

def layout
  @layout
end

Instance Method Details

#columnsObject

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



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/active_scaffold/config/subform.rb', line 20

def columns
  # we want to delay initializing to the @core.update.columns set for as long as possible. but we have to eventually clone, or else have a configuration "leak"
  unless @columns
    if @core.actions.include? :update
      @columns = @core.update.columns.clone
    else
      self.columns = @core.columns._inheritable
    end
  end

  @columns
end