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.
17
18
19
20
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 17
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.
15
16
17
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 15
def association
@association
end
|
#child_association ⇒ Object
Returns the value of attribute child_association.
15
16
17
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 15
def child_association
@child_association
end
|
#constrained_fields ⇒ Object
Returns the value of attribute constrained_fields.
15
16
17
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 15
def constrained_fields
@constrained_fields
end
|
#param_name ⇒ Object
Returns the value of attribute param_name.
15
16
17
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 15
def param_name
@param_name
end
|
#parent_id ⇒ Object
Returns the value of attribute parent_id.
15
16
17
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 15
def parent_id
@parent_id
end
|
#parent_model ⇒ Object
Returns the value of attribute parent_model.
15
16
17
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 15
def parent_model
@parent_model
end
|
#parent_scaffold ⇒ Object
Returns the value of attribute parent_scaffold.
15
16
17
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 15
def parent_scaffold
@parent_scaffold
end
|
Returns the value of attribute scope.
15
16
17
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 15
def scope
@scope
end
|
Class Method Details
.get(model, params) ⇒ Object
5
6
7
8
9
10
11
12
13
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 5
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
40
41
42
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 40
def belongs_to?
false
end
|
#create_with_parent? ⇒ Boolean
76
77
78
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 76
def create_with_parent?
false
end
|
#habtm? ⇒ Boolean
32
33
34
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 32
def habtm?
false
end
|
#has_many? ⇒ Boolean
rubocop:disable Naming/PredicatePrefix
36
37
38
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 36
def has_many?
false
end
|
#has_one? ⇒ Boolean
rubocop:disable Naming/PredicatePrefix
44
45
46
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 44
def has_one?
false
end
|
#match_model?(model) ⇒ Boolean
72
73
74
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 72
def match_model?(model)
false
end
|
#new_instance? ⇒ Boolean
26
27
28
29
30
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 26
def new_instance?
result = @new_instance.nil?
@new_instance = false
result
end
|
#plural_association? ⇒ Boolean
52
53
54
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 52
def plural_association?
has_many? || habtm?
end
|
#readonly? ⇒ Boolean
64
65
66
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 64
def readonly?
false
end
|
#readonly_through_association?(columns) ⇒ Boolean
56
57
58
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 56
def readonly_through_association?(columns)
false
end
|
#singular_association? ⇒ Boolean
48
49
50
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 48
def singular_association?
belongs_to? || has_one?
end
|
#sorted? ⇒ Boolean
68
69
70
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 68
def sorted?(*)
false
end
|
#through_association? ⇒ Boolean
60
61
62
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 60
def through_association?
false
end
|
#to_params ⇒ Object
22
23
24
|
# File 'lib/active_scaffold/data_structures/nested_info.rb', line 22
def to_params
{parent_scaffold: parent_scaffold.controller_path}
end
|