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 ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/active_scaffold/extensions/reverse_associations.rb', line 9 def reverse if @reverse.nil? and not self.[:polymorphic] reverse_matches = reverse_matches_for(self.class_name.constantize) rescue nil # grab first association, or make a wild guess @reverse = reverse_matches.blank? ? false : reverse_matches.first.name end @reverse end |
Instance Method Details
#reverse_for?(klass) ⇒ Boolean
4 5 6 |
# File 'lib/active_scaffold/extensions/reverse_associations.rb', line 4 def reverse_for?(klass) reverse_matches_for(klass).empty? ? false : true end |