Permalink
Browse files

updated oracle initializer according to latest oracle_enhanced adapte…

…r changes
  • Loading branch information...
1 parent 0d41f9c commit 9ac814527656f75ceecae7d998c00bf2597c6fb6 @rsim committed Sep 9, 2010
Showing with 12 additions and 13 deletions.
  1. +1 −1 Gemfile.lock
  2. +11 −12 config/initializers/oracle.rb
View
2 Gemfile.lock
@@ -1,6 +1,6 @@
GIT
remote: git://github.com/rsim/oracle-enhanced.git
- revision: 81444d1c6619d1ed314d077b8e02e50a60783668
+ revision: 26922c439be963f11fb1b2d35975ff185174cb40
specs:
activerecord-oracle_enhanced-adapter (1.3.0)
View
23 config/initializers/oracle.rb
@@ -2,12 +2,8 @@
# will be the same as Ruby Time.local time zone
ENV['TZ'] = 'Europe/Riga'
-require "active_record/connection_adapters/oracle_enhanced_tasks"
-
ActiveSupport.on_load(:active_record) do
- require "active_record/connection_adapters/oracle_enhanced_adapter"
-
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.class_eval do
# some sample settings that I use in my projects
@@ -22,18 +18,21 @@
# to ensure that sequences will start from 1 and without gaps
self.default_sequence_start_value = "1 NOCACHE INCREMENT BY 1"
+
+ # Cache column descriptions between requests.
+ # Highly recommended as currently Arel is doing a lot of additional queries
+ # to get table columns and primary key.
+ # If this is used then you need to restart server in development environment
+ # after running migrations which change table columns.
+ # By default caching is enabled just in test and production environments.
+ if ['development', 'test', 'production'].include? Rails.env
+ self.cache_columns = true
+ end
+
end
# PL/SQL connection
plsql.activerecord_class = ActiveRecord::Base
- # Cache column descriptions between requests.
- # Highly recommended as currently Arel is doing a lot of additional queries
- # to get table columns and primary key.
- # If this is used then you need to restart server in development environment
- # after running migrations which change table columns.
- if ['development', 'test', 'production'].include? Rails.env
- ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.cache_columns = true
- end
end

0 comments on commit 9ac8145

Please sign in to comment.