Problem with ActiveRecord, create, save, and Oracle adapter?

Hi all,

Ruby 1.8.4
Rails 1.1
OCI8 0.1.14

I think I’m hitting an issue with ActiveRecord::Base#save and the Oracle
adapter. Line 158 in the schedules_controller.rb file is simply:

158: if @schedule.save
159: flash[:notice] = ‘Schedule was successfully created.’
160: redirect_to :action => ‘list’
161: else
162: render :action => ‘new’
163: end

Here’s the error (which is the same as what’s in the dev log):

ArgumentError in Schedules#create

wrong number of arguments (1 for 0)

/opt/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/connection_adapters/oracle_adapter.rb:53:in
attributes_with_quotes_pre_oracle' /opt/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/connection_adapters/oracle_adapter.rb:53:inattributes_with_quotes’
/opt/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:2031:in
quoted_column_names' /opt/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1735:increate_without_callbacks’
/opt/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/callbacks.rb:261:in
create_without_timestamps' /opt/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/timestamp.rb:30:increate’
/opt/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1712:in
create_or_update_without_callbacks' /opt/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/callbacks.rb:249:increate_or_update’
/opt/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1388:in
save_without_validation' /opt/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/validations.rb:724:insave_without_transactions’
/opt/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/transactions.rb:126:in
save' /opt/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/connection_adapters/abstract/database_statements.rb:51:intransaction’
/opt/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/transactions.rb:91:in
transaction' /opt/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/transactions.rb:118:intransaction’
/opt/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/transactions.rb:126:in
save' #{RAILS_ROOT}/app/controllers/schedules_controller.rb:158:increate’

Parameters: {“commit”=>“Create”, “schedule”=>{“start_date_id”=>“30”,
“clli_code”=>“TEST”, “slot_id”=>“1”, “hardware_id”=>“6”,
“state_id”=>“6”}}

Headers: {“cookie”=>[], “Cache-Control”=>“no-cache”}

Any ideas?

Thanks,

Dan

Daniel B. wrote:

It’s a bug. Try this patch:

The patch has also been posted to Trac, waiting for it to be applied.

Daniel B. wrote:

Hi all,

Ruby 1.8.4
Rails 1.1
OCI8 0.1.14

I think I’m hitting an issue with ActiveRecord::Base#save and the Oracle
adapter.

It’s a bug. Try this patch:

diff -u oracle_adapter.orig oracle_adapter.rb
— oracle_adapter.orig Tue Mar 28 15:00:06 2006
+++ oracle_adapter.rb Tue Mar 28 15:01:20 2006
@@ -44,11 +44,7 @@
# Enable the id column to be bound into the sql later, by the
adapter’s
insert method.
# This is preferable to inserting the hard-coded value here,
because
the insert method
# needs to know the id value explicitly.

  •  def attributes_with_quotes_pre_oracle #:nodoc:
    
  •    attributes_with_quotes
    
  •  end
    
  •  alias :attributes_with_quotes_pre_oracle :attributes_with_quotes 
    

#:nodoc:
def attributes_with_quotes(creating = true) #:nodoc:
aq = attributes_with_quotes_pre_oracle creating
if connection.class == ConnectionAdapters::OracleAdapter

Regards,

Dan