module AwesomeHstoreTranslate::ActiveRecord::ClassMethods

Public Instance Methods

translates?() click to toggle source
# File lib/awesome_hstore_translate/active_record/class_methods.rb, line 4
def translates?
  included_modules.include?(InstanceMethods)
end
with_fallbacks() { |block| ... } click to toggle source
# File lib/awesome_hstore_translate/active_record/class_methods.rb, line 15
def with_fallbacks(&block)
  before_state = translation_options[:fallbacks]
  toggle_fallback unless translation_options[:fallbacks]
  yield block
  translation_options[:fallbacks] = before_state
end
without_fallbacks() { |block| ... } click to toggle source
# File lib/awesome_hstore_translate/active_record/class_methods.rb, line 8
def without_fallbacks(&block)
  before_state = translation_options[:fallbacks]
  toggle_fallback if translation_options[:fallbacks]
  yield block
  translation_options[:fallbacks] = before_state
end

Protected Instance Methods

toggle_fallback() click to toggle source
# File lib/awesome_hstore_translate/active_record/class_methods.rb, line 24
def toggle_fallback
  translation_options[:fallbacks] = !translation_options[:fallbacks]
end

Private Instance Methods

relation() click to toggle source

Override the default relation methods in order to inject custom finder methods for hstore translations.

Calls superclass method
# File lib/awesome_hstore_translate/active_record/class_methods.rb, line 31
def relation
  super.extending!(QueryMethods)
end