Class: I18nAdmin::HstoreBackend::Store

Inherits:
Object
  • Object
show all
Includes:
RequestStore
Defined in:
lib/i18n_admin/hstore_backend.rb

Instance Method Summary collapse

Methods included from RequestStore

#request_store, #store_key_for

Instance Method Details

#[](path) ⇒ Object



12
13
14
15
# File 'lib/i18n_admin/hstore_backend.rb', line 12

def [](path)
  locale, key = locale_and_key_from(path)
  cached_translations_for(locale).translations[key]
end

#store_translations(locale, key, value) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/i18n_admin/hstore_backend.rb', line 17

def store_translations(locale, key, value)
  translations_set = translations_set_for(locale)
  translations_set.translations[key] = value
  translations_set.translations_will_change!
  translations_set.save
  value
end

#translations_for(locale) ⇒ Object



25
26
27
# File 'lib/i18n_admin/hstore_backend.rb', line 25

def translations_for(locale)
  translations_set_for(locale).translations
end