Sha256: cf529ebba1012f8fca084037b0799b840dc6e638e3feaea193c70da37d8d2172
Contents?: true
Size: 655 Bytes
Versions: 1
Compression:
Stored size: 655 Bytes
Contents
module Ultrasphinx module Associations 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 def get_association_model(klass, entry) get_association(klass, entry).class_name.constantize end def entry_identifies_association?(entry) entry['class_name'] || entry['association_name'] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ultrasphinx-1.7 | lib/ultrasphinx/associations.rb |