Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 31st, 2012  |  syntax: None  |  size: 0.89 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # This needs some love real bad.
  2.   def update_business_user
  3.  
  4.     user = MarketplaceUser.new(:login => params[:login],
  5.     :password => params[:password],
  6.     :password_confirmation => params[:password_confirmation],
  7.     :advertiser_source_id => params[:advertiser_source_id])
  8.  
  9.     existing_user = MarketplaceUser.first(:advertiser_source_id => user.advertiser_source_id)
  10.  
  11.     # wtf is this retardation doing!?? we are updating not creating
  12.     if existing_user
  13.       existing_user.login = user.login
  14.       existing_user.password = user.password
  15.       existing_user.password_confirmation = user.password_confirmation
  16.       user = existing_user
  17.     end
  18.  
  19.     user.authentication_level = :business
  20.  
  21.     # ugly ass hack to make this obj dirty
  22.     # refactor me at some point
  23.     user.make_dirty!
  24.     user.save
  25.  
  26.     redirect_to("/customer_admin/#{user.advertiser_source_id}/account")
  27.  
  28.   end