Guest User

Untitled

a guest
May 24th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. (initial_text = initial_text.to_i) if /\A\d+\z/.match(initial_text)
  2. case initial_text
  3. when COUNTRIES.keys
  4. session[:country_code] = initial_text
  5. next_url = '/find_by_country.json.json'
  6. when THEMES.keys
  7. session[:country_code] = initial_text
  8. next_url = '/find_by_theme.json.json'
  9. when 1
  10. next_url = '/find_by_project_id.json'
  11. when 2
  12. next_url = '/find_by_country.json'
  13. when 3
  14. next_url = '/find_by_theme.json'
  15. when 13..9999
  16. # This is likely a project id, so let's route them there.
  17. session[:project_id] = initial_text.to_i
  18. next_url = '/find_by_project_id.json'
  19. else # do nothing
  20. end
Add Comment
Please, Sign In to add comment