class ThinkingSphinx::ActiveRecord::AssociationProxy::AttributeFinder
Public Class Methods
new(association)
click to toggle source
# File lib/thinking_sphinx/active_record/association_proxy/attribute_finder.rb, line 4 def initialize(association) @association = association end
Public Instance Methods
attribute()
click to toggle source
# File lib/thinking_sphinx/active_record/association_proxy/attribute_finder.rb, line 8 def attribute attributes.detect { |attribute| ThinkingSphinx::ActiveRecord::AssociationProxy::AttributeMatcher.new( attribute, foreign_key ).matches? } or raise "Missing Attribute for Foreign Key #{foreign_key}" end
Private Instance Methods
attributes()
click to toggle source
# File lib/thinking_sphinx/active_record/association_proxy/attribute_finder.rb, line 18 def attributes indices.collect(&:attributes).flatten end
configuration()
click to toggle source
# File lib/thinking_sphinx/active_record/association_proxy/attribute_finder.rb, line 22 def configuration ThinkingSphinx::Configuration.instance end
foreign_key()
click to toggle source
# File lib/thinking_sphinx/active_record/association_proxy/attribute_finder.rb, line 26 def foreign_key @foreign_key ||= reflection_target.foreign_key end
indices()
click to toggle source
# File lib/thinking_sphinx/active_record/association_proxy/attribute_finder.rb, line 30 def indices @indices ||= begin configuration.preload_indices configuration.indices_for_references( *configuration.index_set_class.reference_name(@association.klass) ).reject &:distributed? end end
reflection_target()
click to toggle source
# File lib/thinking_sphinx/active_record/association_proxy/attribute_finder.rb, line 39 def reflection_target target = @association.reflection target = target.through_reflection if target.through_reflection target end