lib/yaks/resource/form/field.rb in yaks-0.9.0 vs lib/yaks/resource/form/field.rb in yaks-0.10.0
- old
+ new
@@ -1,11 +1,12 @@
module Yaks
class Resource
class Form
class Field
- include Yaks::Mapper::Form::Field.attributes.add(:error => nil)
+ include Yaks::Mapper::Form::Field.attributes.add(error: nil)
+ undef value
def value
if type.equal? :select
selected = options.find(&:selected)
selected.value if selected
else
@@ -28,12 +29,12 @@
set = ->(option) { !option.selected && option.value.eql?(value) }
options.each_with_object([]) do |option, new_opts|
new_opts << case option
when unset
- option.update selected: false
+ option.with selected: false
when set
- option.update selected: true
+ option.with selected: true
else
option
end
end
end