Class: ActiveScaffold::Config::Nested

Inherits:
Base show all
Defined in:
lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/nested.rb

Constant Summary collapse

@@shallow_delete =
false

Instance Attribute Summary collapse

Attributes inherited from Base

#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) ⇒ Nested

Returns a new instance of Nested.



5
6
7
8
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/nested.rb', line 5

def initialize(core_config)
  @core = core_config
  self.shallow_delete = self.class.shallow_delete
end

Dynamic Method Handling

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

Instance Attribute Details

#labelObject



29
30
31
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/nested.rb', line 29

def label
  @label ? as_(@label) : as_(:add_existing_model, :model => @core.label)
end

#shallow_deleteObject

instance-level configuration




17
18
19
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/nested.rb', line 17

def shallow_delete
  @shallow_delete
end

Instance Method Details

Add a nested ActionLink



20
21
22
23
24
25
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/nested.rb', line 20

def add_link(label, models, options = {})
  options.merge! :label => label, :type => :record, :security_method => :nested_authorized?, :position => :after, :parameters => {:associations => models.join(' ')}
  options[:html_options] ||= {}
  options[:html_options][:class] = [options[:html_options][:class], models.join(' ')].compact.join(' ')
  @core.action_links.add('nested', options)
end