While porting an application from Rails 1.2.3 to Rails 2.1, I encountered the error message in the title of this post. This particularly application has roots in pre-Rails 1.2.3 days, and the process of porting mainly consisted of simple things like removing calls to end_form_tag, modifying the call to form_tag to use a block, and finding the appropriate url generating method for nested resources. It was going smoothly, though a bit tedious, up until this point.
After examining the call stack, I noticed only one line was a reference to the application code. Surely the error was there, right? I checked the referenced line in my application and found the following:
1 if @event.update_attributes(params[:event]) 2 ... 3 end
At this point, I got a little concerned. I knew there was nothing wrong with the call to update_attributes. Then I remembered that the Rails 1.2.3 version of the application made use of acts_as_tree which was later extracted into a plugin (which I had to install during the process of porting). So the next logical step was to peruse the source of the acts_as_tree plugin. I didn’t find any crazy monkey patching going on in the plugin, which was simultaneously comforting and troubling. After searching the tubes a bit, I stumbled across this post. I thought to myself, “Hey, I remember that post. I remember telling former_colleague about that post when I found it.” It also happens former_colleague was the original developer of the application. But it still didn’t dawn on me at that point, so I just decided to check every location where ActiveRecord was being monkey patched (thankfully, there were not many). The first place I checked slapped me in the face—it was one of the patches demonstrated in the above post.
I removed the offending code, and walked away feeling a little more seasoned. While I have been doing Ruby on and off for awhile, that was the first time I had to debug an issue involving monkey patching.
I'm Jim Barnett, a software developer based in Dallas, TX.
I began my career working for an
Hi Jim, I´m a brazilian programer, and my english is not so good. I had a same problem in a application, but in my case, i use a simple update_attribute and ....bum a exception hapen. Take a look: ArgumentError in RequisicaosController#enviar_rede wrong number of arguments (3 for 1) RAILS_ROOT: C:/RoR/dev/asac Application Trace | Framework Trace | Full Trace c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:2875:in `attributes_with_quotes' I´m using the rails 2.3.2 and oci8 (oracle adapter) Please, i´m desesperate, may you help? Any ideas... Thank you!!!! Wilson Aquino willinos@gmail.com
Posted by Wilson Aquino at Wed Apr 01 22:41:57 +0000 2009