Guest User

Untitled

a guest
Mar 11th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. ##config/database.yml (add a new section, presence_tools)
  2. # SQLite version 3.x
  3. # gem install sqlite3-ruby (not necessary on OS X Leopard)
  4. development:
  5. adapter: sqlite3
  6. database: db/development.sqlite3
  7. timeout: 5000
  8.  
  9. # Warning: The database defined as 'test' will be erased and
  10. # re-generated from your development database when you run 'rake'.
  11. # Do not set this db to the same as development or production.
  12. test:
  13. adapter: sqlite3
  14. database: db/test.sqlite3
  15. timeout: 5000
  16.  
  17. production:
  18. adapter: sqlite3
  19. database: db/production.sqlite3
  20. timeout: 5000
  21.  
  22. #Configuration to connect to the production Presence PREP (PCO)
  23. #database
  24. presence_prep:
  25. adapter: oracle
  26. username: prep
  27. password: prep
  28. database: 10.0.1.199/xe
  29.  
  30. #Configuration to connect to the production ODBC
  31. #database for future use
  32. custom_odbc:
  33. adapter: odbc
  34. username: prep
  35. password: prep
  36. database: 10.0.1.199/xe
  37.  
  38. ##app/controller/application.rb
  39. # Filters added to this controller apply to all controllers in the application.
  40. # Likewise, all the methods added will be available for all controllers.
  41.  
  42. class ApplicationController < ActionController::Base
  43. helper :all # include all helpers, all the time
  44.  
  45. # See ActionController::RequestForgeryProtection for details
  46. # Uncomment the :secret if you're not using the cookie session store
  47. protect_from_forgery # :secret => 'fef7e934f0787fc5eb358ba0de0c6b4b'
  48. require 'yaml'
  49. require 'soap/wsdlDriver'
  50.  
  51. #Provides additional database connections
  52. before_filter :set_extra_db_connections
  53. def set_extra_db_connections
  54. #Connect to the Presence PREP repository and assign those models to this connection
  55. extra_presence = YAML.load(File.open(File.join(RAILS_ROOT,"config/database.yml"),"r"))["presence_prep"]
  56. PcoOutboundqueue.establish_connection(extra_presence)
  57. PcoDonotcalllist.establish_connection(extra_presence)
  58. PcoLoad.establish_connection(extra_presence)
  59. PcoOutboundservice.establish_connection(extra_presence)
  60.  
  61. #Connect to the secondary ODBC repository and assign those models to this connection
  62. #Coming soon....
  63. #extra_odbc = YAML.load(File.open(File.join(RAILS_ROOT,"config/database.yml"),"r"))["presence_prep"]
  64. #New_Model.establish_connection(extra_odbc)
  65. end
Add Comment
Please, Sign In to add comment