class ActiveScaffold::Config::Nested
Attributes
ignore_order_from_association[RW]
label[W]
the label for this Nested action. used for the header.
shallow_delete[RW]
instance-level configuration
Public Class Methods
new(core_config)
click to toggle source
Calls superclass method
ActiveScaffold::Config::Base.new
# File lib/active_scaffold/config/nested.rb, line 5 def initialize(core_config) super @label = :add_existing_model @shallow_delete = self.class.shallow_delete @ignore_order_from_association = self.class.ignore_order_from_association end
Public Instance Methods
add_link(attribute, options = {})
click to toggle source
Add a nested ActionLink
# File lib/active_scaffold/config/nested.rb, line 26 def add_link(attribute, options = {}) column = @core.columns[attribute.to_sym] if column && column.association label = if column.polymorphic_association? column.label else column.association.klass.model_name.human(:count => column.singular_association? ? 1 : 2, :default => column.association.klass.name.pluralize) end options.reverse_merge! :security_method => :nested_authorized?, :label => label action_group = options.delete(:action_group) || self.action_group action_link = @core.link_for_association(column, options) @core.action_links.add_to_group(action_link, action_group) unless action_link.nil? action_link elsif column.nil? raise ArgumentError, "unknown column #{attribute}" elsif column.association.nil? raise ArgumentError, "column #{attribute} is not an association" end end
add_scoped_link(named_scope, options = {})
click to toggle source
# File lib/active_scaffold/config/nested.rb, line 47 def add_scoped_link(named_scope, options = {}) action_link = @core.link_for_association_as_scope(named_scope.to_sym, options) @core.action_links.add_to_group(action_link, action_group) unless action_link.nil? end