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
33
34
35
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 33
def as
@association.options[:as]
end
|
#counter_cache_hack? ⇒ Boolean
58
59
60
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 58
def counter_cache_hack?
belongs_to? && counter_cache && Rails.version < '6.0'
end
|
#dependent ⇒ Object
37
38
39
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 37
def dependent
@association.options[:dependent]
end
|
42
43
44
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 42
def inverse
@association.inverse_of&.name
end
|
#inverse_klass ⇒ Object
29
30
31
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 29
def inverse_klass
@association.active_record
end
|
#quoted_primary_key ⇒ Object
50
51
52
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 50
def quoted_primary_key
@association.klass.quoted_primary_key
end
|
#quoted_table_name ⇒ Object
46
47
48
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 46
def quoted_table_name
@association.klass.quoted_table_name
end
|
#readonly? ⇒ Boolean
13
14
15
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 13
def readonly?
scope_values[:readonly]
end
|
#respond_to_target? ⇒ Boolean
54
55
56
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 54
def respond_to_target?
true
end
|
25
26
27
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 25
def scope
@association.scope
end
|
#source_reflection ⇒ Object
21
22
23
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 21
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
17
18
19
|
# File 'lib/active_scaffold/data_structures/association/active_record.rb', line 17
def through_reflection
@association.through_reflection if through?
end
|