Class: ActiveRecord::Reflection::AssociationReflection

Inherits:
Object
  • Object
show all
Defined in:
lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#reverseObject



9
10
11
12
13
14
15
16
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb', line 9

def reverse
  if @reverse.nil? and not self.options[:polymorphic]
    reverse_matches = reverse_matches_for(self.class_name.constantize)
    # grab first association, or make a wild guess
    @reverse = reverse_matches.empty? ? false : reverse_matches.first.name
  end
  @reverse
end

Instance Method Details

#reverse_for?(klass) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb', line 4

def reverse_for?(klass)
  reverse_matches_for(klass).empty? ? false : true
end