module ActiverecordI18n
Constants
- VERSION
Public Class Methods
get_item(key, default_value=nil)
click to toggle source
# File lib/activerecord_i18n.rb, line 17 def self.get_item(key, default_value=nil) translation = ActiverecordI18nTranslation.where(key: key.downcase, locale: I18n.locale).first_or_create() if !translation.value translation.value = (default_value || '').gsub('-', ' ') translation.save end return translation.value end
get_translation(key, default_value=nil, current_template=nil)
click to toggle source
# File lib/activerecord_i18n.rb, line 12 def self.get_translation(key, default_value=nil, current_template=nil) path = (key[0] == '.' and current_template) ? current_template.virtual_path.gsub('/', '.') + key : key return ActiverecordI18n.get_item(path, default_value || key) end
setup() { |self| ... }
click to toggle source
# File lib/activerecord_i18n.rb, line 8 def self.setup yield self end