Module: Ultrasphinx::Associations
- Included in:
- Configure, Fields, Search::Internals
- Defined in:
- lib/ultrasphinx/associations.rb
Instance Method Summary collapse
Instance Method Details
#get_association(klass, entry) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/ultrasphinx/associations.rb', line 4 def get_association(klass, entry) if value = entry['class_name'] klass.reflect_on_all_associations.detect do |assoc| assoc.class_name == value end elsif value = entry['association_name'] klass.reflect_on_all_associations.detect do |assoc| assoc.name.to_s == value.to_s end end end |
#get_association_model(klass, entry) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/ultrasphinx/associations.rb', line 16 def get_association_model(klass, entry) association = get_association(klass, entry) if association association.class_name.constantize else entry['class_name'].constantize end end |