Class: ActiveRecord::Reflection::AssociationReflection
- Defined in:
- lib/active_scaffold/extensions/reverse_associations.rb
Overview
:nodoc:
Instance Attribute Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#reverse(klass = nil) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/active_scaffold/extensions/reverse_associations.rb', line 10 def reverse(klass = nil) unless defined? @reverse @reverse ||= inverse_of.try(:name) end @reverse || (autodetect_inverse(klass).try(:name) unless klass.nil?) end |
Instance Method Details
#inverse_for?(klass) ⇒ Boolean
4 5 6 7 |
# File 'lib/active_scaffold/extensions/reverse_associations.rb', line 4 def inverse_for?(klass) inverse_class = inverse_of.try(:active_record) inverse_class.present? && (inverse_class == klass || klass < inverse_class) end |
#inverse_of_with_autodetect ⇒ Object
17 18 19 |
# File 'lib/active_scaffold/extensions/reverse_associations.rb', line 17 def inverse_of_with_autodetect inverse_of_without_autodetect || autodetect_inverse end |