use simple_form and hash updates
This commit is contained in:
@ -36,15 +36,8 @@ module Merged
|
||||
end
|
||||
|
||||
def update
|
||||
@card.allowed_fields.each do |key|
|
||||
if( params.has_key?(key) )
|
||||
@card.update(key, params[key])
|
||||
end
|
||||
end
|
||||
options = params[:option]
|
||||
@card.option_definitions.each do |option|
|
||||
@card.set_option(option.name, options[option.name])
|
||||
end if options
|
||||
@card.update(params[:card])
|
||||
@card.update_options( params[:options])
|
||||
@card.edit_save(current_member.email)
|
||||
redirect_to section_cards_url(@card.section.id) , notice: "Updated #{@card.header}"
|
||||
end
|
||||
|
@ -66,10 +66,7 @@ module Merged
|
||||
|
||||
def update
|
||||
@section.update(params[:section])
|
||||
options = params[:option]
|
||||
@section.option_definitions.each do |option|
|
||||
@section.set_option(option.name, options[option.name])
|
||||
end if options
|
||||
@section.update_options( params[:options])
|
||||
@section.edit_save(current_member.email)
|
||||
redirect_to :section , notice: "Update ok"
|
||||
end
|
||||
|
Reference in New Issue
Block a user