Module: HstoreTranslate::Translates::ActiveRecordWithHstoreTranslate

Defined in:
lib/hstore_translate/translates/active_record_with_hstore_translates.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/hstore_translate/translates/active_record_with_hstore_translates.rb', line 9

def method_missing(method_name, *args)
  translated_attr_name, locale, assigning = parse_translated_attribute_accessor(method_name)

  return super(method_name, *args) unless translated_attr_name

  if assigning
    write_hstore_translation(translated_attr_name, args.first, locale)
  else
    read_hstore_translation(translated_attr_name, locale)
  end
end

Instance Method Details

#respond_to?(symbol, include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
# File 'lib/hstore_translate/translates/active_record_with_hstore_translates.rb', line 4

def respond_to?(symbol, include_all = false)
  return true if parse_translated_attribute_accessor(symbol)
  super(symbol, include_all)
end