class ThinkingSphinx::ActiveRecord::AssociationProxy::AttributeMatcher
Attributes
attribute[R]
foreign_key[R]
Public Class Methods
new(attribute, foreign_key)
click to toggle source
# File lib/thinking_sphinx/active_record/association_proxy/attribute_matcher.rb, line 2 def initialize(attribute, foreign_key) @attribute, @foreign_key = attribute, foreign_key.to_s end
Public Instance Methods
matches?()
click to toggle source
# File lib/thinking_sphinx/active_record/association_proxy/attribute_matcher.rb, line 6 def matches? return false if many? column_name_matches? || attribute_name_matches? || multi_singular_match? end
Private Instance Methods
attribute_name_matches?()
click to toggle source
# File lib/thinking_sphinx/active_record/association_proxy/attribute_matcher.rb, line 18 def attribute_name_matches? name == foreign_key end
column()
click to toggle source
# File lib/thinking_sphinx/active_record/association_proxy/attribute_matcher.rb, line 26 def column attribute.respond_to?(:columns) ? attribute.columns.first : attribute.column end
column_name_matches?()
click to toggle source
# File lib/thinking_sphinx/active_record/association_proxy/attribute_matcher.rb, line 22 def column_name_matches? column.__name.to_s == foreign_key end
many?()
click to toggle source
# File lib/thinking_sphinx/active_record/association_proxy/attribute_matcher.rb, line 31 def many? attribute.respond_to?(:columns) && attribute.columns.many? end
multi_singular_match?()
click to toggle source
# File lib/thinking_sphinx/active_record/association_proxy/attribute_matcher.rb, line 35 def multi_singular_match? multi? && name.singularize == foreign_key end