Guest User

Untitled

a guest
Jul 22nd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. Downloading postal codes.
  2. rake aborted!
  3. /app/app/models/postal_code.rb:13: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or 'n'
  4. when Integer: first(:conditions => { :code => code })
  5. ^
  6. /app/app/models/postal_code.rb:14: syntax error, unexpected keyword_when, expecting keyword_end
  7. when Hash: first(:conditions => {...
  8. ^
  9. /app/app/models/postal_code.rb:59: syntax error, unexpected keyword_end, expecting $end
  10.  
  11. 11 def self.get(code)
  12. 12 case code
  13. 13 when Integer: first(:conditions => { :code => code })
  14. 14 when Hash: first(:conditions => { :city => code[:city], :state => code[:state] })
  15. 15 else raise InternalException.new("Invalid input.")
  16. 16 end
  17. 17 end
  18.  
  19.  
  20. 51 # now set min and max lat and long accordingly
  21. 52 area[:min_lat] = latitude - area[:lat_degrees]
  22. 53 area[:max_lat] = latitude + area[:lat_degrees]
  23. 54 area[:min_lon] = longitude - area[:lon_degrees]
  24. 55 area[:max_lon] = longitude + area[:lon_degrees]
  25. 56
  26. 57 area
  27. 58 end
  28.  
  29. def self.get(code)
  30. case code
  31. when Integer then first(:conditions => { :code => code })
  32. when Hash then first(:conditions => { :city => code[:city], :state => code[:state] })
  33. else raise InternalException.new("Invalid input.")
  34. end
  35. end
  36.  
  37. * Deprecated syntax
  38. o colon (:) instead of "then" in if/unless or case expression.
  39.  
  40. case code
  41. when Integer then first(:conditions => { :code => code })
  42. when Hash then first(:conditions => { :city => code[:city], :state => code[:state] })
  43. else raise InternalException.new("Invalid input.")
  44. end
  45.  
  46. case code
  47. when Integer
  48. first(:conditions => { :code => code })
  49. when Hash
  50. first(:conditions => { :city => code[:city], :state => code[:state] })
  51. else
  52. raise InternalException.new("Invalid input.")
  53. end
Add Comment
Please, Sign In to add comment