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?, 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.



144
145
146
147
148
149
150
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 144

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



156
157
158
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 156

def name
  scope
end

#to_paramsObject



152
153
154
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 152

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