Guest User

Untitled

a guest
May 25th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. # monkey patches for Rails 3 beta that are needed for oracle_enhanced adapter
  2. require 'rails3_oracle_patches'
  3.  
  4. # it's recommended to set time zone to ensure that Oracle session time zone
  5. # will be the same as Ruby Time.local time zone
  6. ENV['TZ'] = 'Eastern Time (US & Canada)'
  7.  
  8. ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.class_eval do
  9. # some sample settings that I use in my projects
  10.  
  11. self.emulate_integers_by_column_name = true
  12. self.emulate_dates_by_column_name = true
  13. self.emulate_booleans_from_strings = true
  14.  
  15. # set string to date format if using e.g. calendar helpers
  16.  
  17. # self.string_to_date_format = "%d.%m.%Y"
  18. # self.string_to_time_format = "%d.%m.%Y %H:%M:%S"
  19.  
  20. # to ensure that sequences will start from 1 and without gaps
  21. self.default_sequence_start_value = "1 NOCACHE INCREMENT BY 1"
  22. end
  23.  
  24. # PL/SQL connection
  25. plsql.activerecord_class = ActiveRecord::Base
  26.  
  27. # Cache column descriptions between requests.
  28. # Highly recommended as currently Arel is doing a lot of additional queries
  29. # to get table columns and primary key.
  30. # If this is used then you need to restart server in development environment
  31. # after running migrations which change table columns.
  32. if ['development', 'test', 'production'].include? Rails.env
  33. ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.cache_columns = true
  34. end
Add Comment
Please, Sign In to add comment