Module: Kanal::Plugins::UserSystem::Helpers::JsonValueConverterMixin

Included in:
Models::KanalUserProperty
Defined in:
lib/kanal/plugins/user_system/helpers/json_value_converter_mixin.rb

Overview

Helps using .value property with restoring/saving from json representation in .raw_value model field

Instance Method Summary collapse

Instance Method Details

#valueObject



13
14
15
# File 'lib/kanal/plugins/user_system/helpers/json_value_converter_mixin.rb', line 13

def value
  JSON.parse(raw_value)
end

#value=(val) ⇒ Object



17
18
19
# File 'lib/kanal/plugins/user_system/helpers/json_value_converter_mixin.rb', line 17

def value=(val)
  self.raw_value = JSON.generate(val)
end