Sha256: 634852657e0731a6980b509fbf8a71df9fa0060c88510bc685bdb53968175fc6
Contents?: true
Size: 475 Bytes
Versions: 5
Compression:
Stored size: 475 Bytes
Contents
class BooleanField < Field def default_input_type :radio end def json_action(action, value, record) case action when 'set' record.set_raw(name, !!value) when 'toggle' record.set_raw(name, !record.get(name)) end record.changed!(name) end def from_json(value, record) if value == 'true' true elsif value == 'false' false else !!value end end end Field::TYPES['boolean'] = BooleanField
Version data entries
5 entries across 5 versions & 1 rubygems