Skip to content

Instantly share code, notes, and snippets.

@abloom
Created January 21, 2009 19:47
Show Gist options
  • Save abloom/50147 to your computer and use it in GitHub Desktop.
Save abloom/50147 to your computer and use it in GitHub Desktop.
def create
old_values = GeneralEdit.new(@board.attributes.slice(*GeneralEdit.new.attribute_names))
new_values = GeneralEdit.new(params[:general_edit])
new_values.attributes.each { |key, value| if value == "" then new_values[key] = nil end }
changed = new_values.attributes.diff(old_values.attributes)
session[:edit_result_id] = nil
if !changed.empty? then
@edit = GeneralEdit.new(changed)
@edit.board_id = params[:id]
@edit.save
render :action => "busy", :id => @edit.id
else
redirect_to :action => "view", :id => params[:id]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment