module AwesomeHstoreTranslate::ActiveRecord::Core::ClassMethods

Public Instance Methods

find_by(*args) click to toggle source
Calls superclass method
# File lib/awesome_hstore_translate/active_record/core.rb, line 5
def find_by(*args)
  attrs = args.first
  if attrs.is_a?(Hash) && contains_translated_attributes(attrs)
    where(attrs).limit(1).first
  else
    super
  end
end

Private Instance Methods

contains_translated_attributes(attrs) click to toggle source
# File lib/awesome_hstore_translate/active_record/core.rb, line 16
def contains_translated_attributes(attrs)
  !(self.translated_attribute_names & attrs.keys).empty?
end