Skip to content

Instantly share code, notes, and snippets.

@tbuehlmann
Created June 2, 2010 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbuehlmann/422631 to your computer and use it in GitHub Desktop.
Save tbuehlmann/422631 to your computer and use it in GitHub Desktop.
@contact = Contact.find params[:id]
@contact.attributes = params[:contact]
if params[:is_supplier] == '1'
@contact.type = 'supplier'
elsif params[:is_supplier] == '0'
@contact.type = 'customer'
end
if @contact.save
redirect_to contact_path(@contact), :notice => 'Successfully updated Contact.'
else
render :action => 'edit'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment