Module: Sphinx::Globalize::ClassMethods
- Defined in:
- lib/sphinx_globalize.rb
Instance Method Summary collapse
Instance Method Details
#define_translated_index(*attr_names) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/sphinx_globalize.rb', line 8 def define_translated_index(*attr_names) klass_name = self.table_name.singularize translation_table_name = "#{klass_name}_translations" I18n.available_locales.each do |locale| self.define_index "#{klass_name}_#{locale}" do where "`#{translation_table_name}`.`locale` = '#{locale}'" attr_names.each do |attr| indexes translations(attr), :as => attr, :sortable => true end end end end |