use simple_form and hash updates

This commit is contained in:
2023-01-20 16:49:11 +02:00
parent cb734f9de7
commit fba9f3d2fb
3 changed files with 10 additions and 13 deletions

View File

@ -59,6 +59,7 @@ module Merged
end
def update(hash)
return unless hash
hash.each do |key , value|
raise "unsuported field #{key} for #{template}:#{allowed_fields}" unless allowed_fields.include?(key.to_sym)
if(! attributes[key].nil? ) # first setting ok, types not (yet?) specified
@ -70,6 +71,12 @@ module Merged
end
end
def update_options( options )
return unless options
option_definitions.each do |option|
set_option(option.name, options[option.name])
end
end
#other may be nil
def swap_index_with(other)
return unless other