Class: ActiveScaffold::DataStructures::NestedInfoScope

Inherits:
NestedInfo show all
Defined in:
lib/active_scaffold/data_structures/nested_info.rb

Instance Attribute Summary

Attributes inherited from NestedInfo

#association, #child_association, #constrained_fields, #param_name, #parent_id, #parent_model, #parent_scaffold, #scope

Instance Method Summary collapse

Methods inherited from NestedInfo

#belongs_to?, #create_with_parent?, get, #habtm?, #has_many?, #has_one?, #match_model?, #new_instance?, #plural_association?, #readonly?, #readonly_through_association?, #singular_association?, #sorted?, #through_association?

Constructor Details

#initialize(model, params) ⇒ NestedInfoScope

Returns a new instance of NestedInfoScope.



164
165
166
167
168
169
170
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 164

def initialize(model, params)
  super
  @scope = params[:named_scope].to_sym
  @param_name = parent_model.name.foreign_key.to_sym
  @parent_id = params[@param_name]
  @constrained_fields = []
end

Instance Method Details

#nameObject



176
177
178
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 176

def name
  scope
end

#to_paramsObject



172
173
174
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 172

def to_params
  super.merge(:named_scope => @scope)
end