Forum: Ruby on Rails Problem with ActiveRecord, create, save, and Oracle adapter?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F3b7b8756d0c7f71cc7460cc33aefaee?d=identicon&s=25 Daniel Berger (Guest)
on 2006-03-28 23:49
(Received via mailing list)
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:in
`attributes_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:in
`create_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:in
`create'
/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:in
`create_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:in
`save_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:in
`transaction'
/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:in
`transaction'
/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:in `create'


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
F3b7b8756d0c7f71cc7460cc33aefaee?d=identicon&s=25 Daniel Berger (Guest)
on 2006-03-29 00:19
(Received via mailing list)
Daniel Berger 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.

<snip>

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
E75cda3e915fa209386fae3de962cb6a?d=identicon&s=25 Michael Schoen (Guest)
on 2006-03-29 20:00
(Received via mailing list)
Daniel Berger wrote:
> It's a bug.  Try this patch:

The patch has also been posted to Trac, waiting for it to be applied.
This topic is locked and can not be replied to.