Guest User

Untitled

a guest
Mar 4th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. def hijack_db
  2. # completely ridiculous condition
  3. is_odd = Time.now.hour % 2 == 1
  4.  
  5. # determine the database name
  6. db_name = is_odd ? ?dis_odd_db? : ?dat_even_db?
  7.  
  8. # lets manually connect to the proper db
  9. ActiveRecord::Base.establish_connection(
  10. :adapter => ?mysql?,
  11. :host => ?localhost?,
  12. :username => ?mr_roboto?,
  13. :password => ?secret_secret_i_got_a_secret?,
  14. :database => db_name
  15. )
  16. end
Add Comment
Please, Sign In to add comment