Module: SelectableAttrRails::DbLoadable::Entry

Defined in:
lib/selectable_attr_rails/db_loadable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#name_from_dbObject

Returns the value of attribute name_from_db.



14
15
16
17
# File 'lib/selectable_attr_rails/db_loadable.rb', line 14

def name_from_db
  @names_from_db ||= {}
  @names_from_db[I18n.locale.to_s]
end

Class Method Details

.extended(obj) ⇒ Object



37
38
39
40
41
42
# File 'lib/selectable_attr_rails/db_loadable.rb', line 37

def self.extended(obj)
  obj.instance_eval do
    alias :name_without_from_db :name
    alias :name :name_with_from_db
  end
end

Instance Method Details

#name_with_from_dbObject



24
25
26
# File 'lib/selectable_attr_rails/db_loadable.rb', line 24

def name_with_from_db
  name_from_db || name_without_from_db
end