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.



171
172
173
174
175
176
177
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 171

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



183
184
185
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 183

def name
  scope
end

#to_paramsObject



179
180
181
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 179

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