Class: ActiveScaffold::Config::Nested
- Defined in:
- lib/active_scaffold/config/nested.rb
Constant Summary collapse
- @@shallow_delete =
true
Instance Attribute Summary collapse
-
#label ⇒ Object
writeonly
the label for this Nested action.
-
#shallow_delete ⇒ Object
instance-level configuration —————————-.
Attributes inherited from Base
Instance Method Summary collapse
-
#add_link(attribute, options = {}) ⇒ Object
Add a nested ActionLink.
-
#initialize(core_config) ⇒ Nested
constructor
A new instance of Nested.
Methods inherited from Base
#crud_type, #formats, #formats=, inherited, #label
Methods included from ActiveScaffold::Configurable
Constructor Details
#initialize(core_config) ⇒ Nested
Returns a new instance of Nested.
5 6 7 8 9 10 |
# File 'lib/active_scaffold/config/nested.rb', line 5 def initialize(core_config) super @label = :add_existing_model self.shallow_delete = self.class.shallow_delete @action_group = self.class.action_group.clone if self.class.action_group end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveScaffold::Configurable
Instance Attribute Details
#label=(value) ⇒ Object (writeonly)
the label for this Nested action. used for the header.
33 34 35 |
# File 'lib/active_scaffold/config/nested.rb', line 33 def label=(value) @label = value end |
#shallow_delete ⇒ Object
instance-level configuration
19 20 21 |
# File 'lib/active_scaffold/config/nested.rb', line 19 def shallow_delete @shallow_delete end |
Instance Method Details
#add_link(attribute, options = {}) ⇒ Object
Add a nested ActionLink
22 23 24 25 26 27 28 29 30 |
# File 'lib/active_scaffold/config/nested.rb', line 22 def add_link(attribute, = {}) column = @core.columns[attribute.to_sym] unless column.nil? || column.association.nil? .reverse_merge! :security_method => :nested_authorized?, :label => column.association.associated_class.model_name.human({:count => 2, :default => column.association.associated_class.name.pluralize}) action_link = @core.link_for_association(column, ) action_link.action ||= :index @core.action_links.add_to_group(action_link, action_group) unless action_link.nil? end end |