Advertisement
Guest User

Untitled

a guest
Jul 31st, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. class SubscriptionsController < ApplicationController
  2. def lander
  3. @company=Company.new(params['company'])
  4. @company['email']=params['email'] unless params['email'].nil?
  5. @company['password']=params['password'] unless params['password'].nil?
  6. render :action=>'lander',:layout=>'public_framework'
  7. end
  8. def verify
  9. @company=Company.new
  10. password=params['company'].delete('password')
  11. password_confirmation=params['company'].delete('password_confirmation')
  12. #breakpoint
  13. if (params['csz'].blank?||params['csz'][/^([a-z A-Z'-] ), ([A-Z]{2}) ([0-9] )$/].nil?)
  14. @company.errors.add "City, State and ZipCode cannot be empty and must be in the format 'City, ST ZIP' for example: Springfield, MO 65802"
  15. else
  16. @company['city']=params['csz'][/^([a-z A-Z'-] ), ([A-Z]{2}) ([0-9] )$/,1]
  17. @company['state']=params['csz'][/^([a-z A-Z'-] ), ([A-Z]{2}) ([0-9] )$/,2]
  18. @company['zip']=params['csz'][/^([a-z A-Z'-] ), ([A-Z]{2}) ([0-9] )$/,3]
  19. end
  20. @company=Company.new(params['company'])#undefined method `'password_confirmation'=' for #<Company:0x47dc428>
  21. if (@company.validate)
  22. #then validate user
  23. @user=User.new
  24. @user['email']=@company['email']
  25. @user['password']=password
  26. @user['password_confirmation']=password_confirmation
  27. @user['phone']=@company['dispatch']
  28. @user['fax']=@company['fax']
  29. @user['city']=@company['city']
  30. @user['state']=@company['state']
  31. @user['zip']=@company['zip']
  32. if (@user.validate)
  33. @company.save
  34. @user.save
  35. redirect_to :action=>'send_email'
  36. else
  37. render :action=>'lander'
  38. end
  39. else
  40. render :action=>'lander'
  41. end
  42. end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement