Guest User

Untitled

a guest
Apr 26th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. def url_for( options )
  2. backup_plan = false
  3. #options[:lang] = cookies[:tolk].to_s unless cookies[:tolk].nil?
  4. logger.debug "url_for options: "+options.inspect
  5. unless cookies[:tolk].nil?
  6. if options.class == Hash
  7. options.merge!( { :lang => cookies[:tolk] } )
  8. elsif options.class == String
  9. if options.include? "?"
  10. options += "&"
  11. else
  12. options += "?"
  13. end
  14. options += "lang=#{cookies[:tolk]}"
  15. else
  16. logger.debug "cookie is missing, or options wasn't of a known class! (#{options.class.to_s})"
  17. backup_plan = true
  18. end
  19. end
  20.  
  21. url = old_url_for( options )
  22.  
  23. if backup_plan
  24. if url.include? "?"
  25. url += "&"
  26. else
  27. url += "?"
  28. end
  29. url += "lang=#{cookies[:tolk]}"
  30. end
  31.  
  32. url
  33. end
Add Comment
Please, Sign In to add comment