Short information about latest enhancements in ActiveRecord Oracle enhanced adapter:
- Oracle enhanced adapter is now compatible with composite_primary_keys gem which is quite useful if you are working with legacy databases.
- Adapter now is also working correctly with Rails 2.1 partial_updates enabled. Previously I mentioned that you needed to disable partial_updates when using CLOB/BLOB columns. Now the issue is found and fixed and partial_updates are working with CLOB/BLOB columns.
- Support for other date and time formats when assigning string to :date or :datetime column. For example, if you would like to assign strings with format dd.mm.yyyy to date and datetime columns then add the following configuration options:
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.string_to_date_format = "%d.%m.%Y" ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.string_to_time_format = "%d.%m.%Y %H:%M:%S"
To get the new release of Oracle enhanced adapter do as always:
sudo gem install activerecord-oracle_enhanced-adapter

That’s nice! :)
btw: the link to oracle_enhanced-adapter’s git repo doesn’t work on the rubyforge project page.
Comment by Jesse Hu — July 28, 2008 @ 4:07 am |
This rubyforge page has a link to git repository at rubyforge.org (they recently also started to offer git repository hosting in addition to svn and cvs). Unfortunately they do not allow to put there link to external sites like github.
But I finally fixed website generatation for oracle-enhanced project. So if someone will find oracle-enhanced on rubyforge then hopefully he/she will go to this webpage and will find out that git repository is hosted on github :)
Comment by Raimonds Simanovskis — July 28, 2008 @ 9:11 am |
Hai Raimonds ,
i am new to oracle in rails ,
i searched a lot in net about oracle in rails.
but i didn’t get good result.
your post is really usefull to me.
thanks Raimonds.
Comment by mokkai — August 20, 2008 @ 5:28 pm |
We can’t save or create any ActiveRecord after upgrading from 1.1.5 to 1.1.6. Here is the error.
Looks like it might be in combination with will_paginate plugin.
NoMethodError: undefined method `custom_create_method’ for House(id: integer, description: string):Class
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:1667:in `method_missing_without_paginate’
from /projects/rails/cool_app/vendor/plugins/will_paginate/lib/will_paginate/finder.rb:95:in `method_missing’
from /usr/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.1.6/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:80:in `enhanced_write_lobs’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:173:in `send’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:173:in `evaluate_method’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:161:in `call’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:93:in `run’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:92:in `each’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:92:in `send’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:92:in `run’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:272:in `run_callbacks’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/callbacks.rb:298:in `callback’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/callbacks.rb:208:in `create_or_update’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2200:in `save_without_validation’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/validations.rb:901:in `save_without_dirty’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/dirty.rb:75:in `save_without_transactions’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:106:in `save’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:79:in `transaction’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:98:in `transaction’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:106:in `save’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:118:in `rollback_active_record_state!’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:106:in `save’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:640:in `create
Comment by Jason — August 20, 2008 @ 10:25 pm |
I also just found that you get this error if you have not installed ruby-plsql gem.
So the quick workaround is to install ruby-plsql gem. And I will try to fix and release new version of adapter ASAP which will work also without ruby-plsql gem.
Comment by Raimonds Simanovskis — August 20, 2008 @ 11:01 pm |
Released new version 1.1.7 where I fixed that adapter works also without ruby-plsql gem.
Comment by Raimonds Simanovskis — August 20, 2008 @ 11:24 pm |
Hi Raimonds,
I see that you are Oracle+RoR guru with big OracleAdapter experience so I dare to ask you a question:
I got some field names like “number” or “group” in my model which need to be quoted; what would be the best way of forcing adapter to do the quoting?
from code…
def quote_column_name(name) #:nodoc:
name.to_s =~ /[A-Z]/ ? “\”#{name}\”" : name
end
… will it be making it camel case?
But then by default ruby makes lower case column names – a Number between them will look awkward :(
Comment by Kodak — October 24, 2008 @ 7:34 pm |
I avoid from using Oracle reserved words as column names as it might require too much patching of oracle adapter and it could be too fragile solution.
Why do you need to use “number” or “group” as column names? Isn’t it easier just to change these column names to something different? And then if necessary you can define attribute aliases in your model:
def name
xxx_name
end
def group
xxx_group
end
Btw please use discussion group http://groups.google.com/group/oracle-enhanced if you have further questions – there are some other people as well who might help you with some ideas :)
Comment by Raimonds Simanovskis — October 25, 2008 @ 9:27 am |
ok, thanks (problem with aliasing is that you will still need to use old names in find fitrers)
Comment by Kodak — October 25, 2008 @ 3:52 pm |