Class: ActiveScaffold::DataStructures::NestedInfo
  
  
  
  
  
    - Inherits:
 
    - 
      Object
      
        
          - Object
 
          
            - ActiveScaffold::DataStructures::NestedInfo
 
          
        
        show all
      
     
  
  
  
  
  
  
  
  
  
  
    - Defined in:
 
    - lib/active_scaffold/data_structures/nested_info.rb
 
  
  
 
  Instance Attribute Summary collapse
  
  
    
      Class Method Summary
      collapse
    
    
  
    
      Instance Method Summary
      collapse
    
    
  
  Constructor Details
  
    
  
  
    #initialize(model, params)  ⇒ NestedInfo 
  
  
  
  
    
Returns a new instance of NestedInfo.
   
 
  
  
    
      
15
16
17
18 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 15
def initialize(model, params)
  @parent_scaffold = "#{params[:parent_scaffold].to_s.camelize}Controller".constantize
  @parent_model = @parent_scaffold.active_scaffold_config.model
end
     | 
  
 
  
 
  
    Instance Attribute Details
    
      
      
      
  
  
    #association  ⇒ Object 
  
  
  
  
    
Returns the value of attribute association.
   
 
  
  
    
      
13
14
15 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 13
def association
  @association
end
 
     | 
  
 
    
      
      
      
  
  
    #child_association  ⇒ Object 
  
  
  
  
    
Returns the value of attribute child_association.
   
 
  
  
    
      
13
14
15 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 13
def child_association
  @child_association
end
 
     | 
  
 
    
      
      
      
  
  
    #constrained_fields  ⇒ Object 
  
  
  
  
    
Returns the value of attribute constrained_fields.
   
 
  
  
    
      
13
14
15 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 13
def constrained_fields
  @constrained_fields
end
 
     | 
  
 
    
      
      
      
  
  
    #param_name  ⇒ Object 
  
  
  
  
    
Returns the value of attribute param_name.
   
 
  
  
    
      
13
14
15 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 13
def param_name
  @param_name
end
 
     | 
  
 
    
      
      
      
  
  
    #parent_id  ⇒ Object 
  
  
  
  
    
Returns the value of attribute parent_id.
   
 
  
  
    
      
13
14
15 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 13
def parent_id
  @parent_id
end
 
     | 
  
 
    
      
      
      
  
  
    #parent_model  ⇒ Object 
  
  
  
  
    
Returns the value of attribute parent_model.
   
 
  
  
    
      
13
14
15 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 13
def parent_model
  @parent_model
end
 
     | 
  
 
    
      
      
      
  
  
    #parent_scaffold  ⇒ Object 
  
  
  
  
    
Returns the value of attribute parent_scaffold.
   
 
  
  
    
      
13
14
15 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 13
def parent_scaffold
  @parent_scaffold
end
 
     | 
  
 
    
      
      
      
  
  
    
Returns the value of attribute scope.
   
 
  
  
    
      
13
14
15 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 13
def scope
  @scope
end
 
     | 
  
 
    
   
  
    Class Method Details
    
      
  
  
    .get(model, params)  ⇒ Object 
  
  
  
  
    
      
3
4
5
6
7
8
9
10
11 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 3
def self.get(model, params)
  if params[:association].nil?
    ActiveScaffold::DataStructures::NestedInfoScope.new(model, params)
  else
    ActiveScaffold::DataStructures::NestedInfoAssociation.new(model, params)
  end
rescue ActiveScaffold::ControllerNotFound
  nil
end
     | 
  
 
    
   
  
    Instance Method Details
    
      
  
  
    #belongs_to?  ⇒ Boolean 
  
  
  
  
    
      
38
39
40 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 38
def belongs_to?
  false
end
 
     | 
  
 
    
      
  
  
    #create_with_parent?  ⇒ Boolean 
  
  
  
  
    
      
74
75
76 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 74
def create_with_parent?
  false
end
 
     | 
  
 
    
      
  
  
    #habtm?  ⇒ Boolean 
  
  
  
  
    
      
30
31
32 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 30
def habtm?
  false
end
 
     | 
  
 
    
      
  
  
    #has_many?  ⇒ Boolean 
  
  
  
  
    
rubocop:disable Naming/PredicateName
   
 
  
    
      
34
35
36 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 34
def has_many? 
  false
end
 
     | 
  
 
    
      
  
  
    #has_one?  ⇒ Boolean 
  
  
  
  
    
rubocop:disable Naming/PredicateName
   
 
  
    
      
42
43
44 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 42
def has_one? 
  false
end
 
     | 
  
 
    
      
  
  
    #match_model?(model)  ⇒ Boolean 
  
  
  
  
    
      
70
71
72 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 70
def match_model?(model)
  false
end
 
     | 
  
 
    
      
  
  
    #new_instance?  ⇒ Boolean 
  
  
  
  
    
      
24
25
26
27
28 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 24
def new_instance?
  result = @new_instance.nil?
  @new_instance = false
  result
end
 
     | 
  
 
    
      
  
  
    #plural_association?  ⇒ Boolean 
  
  
  
  
    
      
50
51
52 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 50
def plural_association?
  has_many? || habtm?
end
 
     | 
  
 
    
      
  
  
    #readonly?  ⇒ Boolean 
  
  
  
  
    
      
62
63
64 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 62
def readonly?
  false
end
 
     | 
  
 
    
      
  
  
    #readonly_through_association?(columns)  ⇒ Boolean 
  
  
  
  
    
      
54
55
56 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 54
def readonly_through_association?(columns)
  false
end
 
     | 
  
 
    
      
  
  
    #singular_association?  ⇒ Boolean 
  
  
  
  
    
      
46
47
48 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 46
def singular_association?
  belongs_to? || has_one?
end
 
     | 
  
 
    
      
  
  
    #sorted?  ⇒ Boolean 
  
  
  
  
    
      
66
67
68 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 66
def sorted?(*)
  false
end
 
     | 
  
 
    
      
  
  
    #through_association?  ⇒ Boolean 
  
  
  
  
    
      
58
59
60 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 58
def through_association?
  false
end
 
     | 
  
 
    
      
  
  
    #to_params  ⇒ Object 
  
  
  
  
    
      
20
21
22 
     | 
    
      # File 'lib/active_scaffold/data_structures/nested_info.rb', line 20
def to_params
  {parent_scaffold: parent_scaffold.controller_path}
end
     |