Class: ActiveScaffold::DataStructures::Association::ActiveRecord
- Inherits:
-
Abstract
- Object
- Abstract
- ActiveScaffold::DataStructures::Association::ActiveRecord
show all
- Defined in:
- lib/active_scaffold/data_structures/association/active_record.rb
Instance Attribute Summary
Attributes inherited from Abstract
#reverse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Abstract
#allow_join?, #belongs_to?, #collection?, #counter_cache, #habtm?, #has_many?, #has_one?, #initialize, #inverse_for?, #klass, #polymorphic?, #primary_key, #reverse_association, #singular?, #through_collection?, #through_singular?
Class Method Details
.reflect_on_all_associations(klass) ⇒ Object
3
4
5
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 3
def self.reflect_on_all_associations(klass)
klass.reflect_on_all_associations
end
|
Instance Method Details
37
38
39
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 37
def as
@association.options[:as]
end
|
#counter_cache_hack? ⇒ Boolean
62
63
64
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 62
def counter_cache_hack?
belongs_to? && counter_cache && Rails.version < '6.0'
end
|
#dependent ⇒ Object
41
42
43
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 41
def dependent
@association.options[:dependent]
end
|
46
47
48
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 46
def inverse
@association.inverse_of&.name
end
|
#inverse_klass ⇒ Object
33
34
35
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 33
def inverse_klass
@association.active_record
end
|
#nested? ⇒ Boolean
13
14
15
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 13
def nested?
@association.nested?
end
|
#quoted_primary_key ⇒ Object
54
55
56
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 54
def quoted_primary_key
@association.klass.quoted_primary_key
end
|
#quoted_table_name ⇒ Object
50
51
52
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 50
def quoted_table_name
@association.klass.quoted_table_name
end
|
#readonly? ⇒ Boolean
17
18
19
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 17
def readonly?
scope_values[:readonly]
end
|
#respond_to_target? ⇒ Boolean
58
59
60
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 58
def respond_to_target?
true
end
|
29
30
31
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 29
def scope
@association.scope
end
|
#source_reflection ⇒ Object
25
26
27
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 25
def source_reflection
@association.source_reflection if through?
end
|
#through? ⇒ Boolean
9
10
11
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 9
def through?
@association.options[:through].present?
end
|
#through_reflection ⇒ Object
21
22
23
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 21
def through_reflection
@association.through_reflection if through?
end
|