Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def hijack_db
- # completely ridiculous condition
- is_odd = Time.now.hour % 2 == 1
- # determine the database name
- db_name = is_odd ? ?dis_odd_db? : ?dat_even_db?
- # lets manually connect to the proper db
- ActiveRecord::Base.establish_connection(
- :adapter => ?mysql?,
- :host => ?localhost?,
- :username => ?mr_roboto?,
- :password => ?secret_secret_i_got_a_secret?,
- :database => db_name
- )
- end
Add Comment
Please, Sign In to add comment