Class: ThinkingSphinx::ActiveRecord::AssociationProxy::AttributeFinder
- Inherits:
-
Object
- Object
- ThinkingSphinx::ActiveRecord::AssociationProxy::AttributeFinder
- Defined in:
- lib/thinking_sphinx/active_record/association_proxy/attribute_finder.rb
Instance Method Summary collapse
- #attribute ⇒ Object
-
#initialize(association) ⇒ AttributeFinder
constructor
A new instance of AttributeFinder.
Constructor Details
#initialize(association) ⇒ AttributeFinder
Returns a new instance of AttributeFinder.
2 3 4 |
# File 'lib/thinking_sphinx/active_record/association_proxy/attribute_finder.rb', line 2 def initialize(association) @association = association end |
Instance Method Details
#attribute ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/thinking_sphinx/active_record/association_proxy/attribute_finder.rb', line 6 def attribute attributes.detect { |attribute| # Don't bother with attributes built from multiple columns next if attribute.columns.many? attribute.columns.first.__name == foreign_key.to_sym || attribute.name == foreign_key.to_s } or raise "Missing Attribute for Foreign Key #{foreign_key}" end |