Module: ActiveMetadata::ValueFormatter

Extended by:
ActiveSupport::Concern
Included in:
History
Defined in:
lib/active_metadata/value_formatter.rb

Instance Method Summary collapse

Instance Method Details

#valueObject



4
5
6
7
8
9
# File 'lib/active_metadata/value_formatter.rb', line 4

def value
  instance = model_class.constantize.new
  return read_attribute(:value).to_s unless instance.respond_to?(label.to_sym)
  instance.send :write_attribute, label.to_sym, read_attribute(:value)
  instance.send label
end