dchapman
dchapman

Reputation: 365

wrong number of arguments (3 for 2) after upgrading from Rails 3.0.14 to Rails 3.1.4

Everything was working fine in Rails 3.0.14, but after changing gem 'rails', '3.0.14' to gem 'rails', '3.1.4' and running bundle update rails I now get the following error:

Started GET "/" for 127.0.0.1 at 2012-03-16 11:11:44 -0400
  Processing by PagesController#index as HTML
  Completed 500 Internal Server Error in 54ms
  ArgumentError (wrong number of arguments (3 for 2)):
     app/controllers/application_controller.rb:37:in `customize_by_subdomain'```

The most popular answer seemed to be that sqlite3 needed to be updated, but I did bundle update sqlite3 and I still have the same problem.

Here is the full trace: https://gist.github.com/2050530

The method that it is complaining about looks like this:

35 def customize_by_subdomain
36   subdomain = (request.subdomain.present? && request.subdomain != 'www' && request.subdomain) || 'launch'
37   @current_org = Organization.find_by_subdomain(subdomain) || Organization.find_by_subdomain('launch')
38 end

I have looked at the multitude of similar questions and I not found anything that solves my problem. The closest was question to mine was: wrong number of arguments (3 for 1) after upgrading rails from 3.1.1 to 3.1.3 but I am using authlogic and the version I am using didn't change after upgrading rails.

The only other interesting thing is my entire test suite passes, except for one request/integration spec which goes through the process of creating a new user. It seems strange that my request specs work fine when I can't even access a page in development.

Any ideas on what I can do to get to the bottom of this?

Upvotes: 0

Views: 693

Answers (1)

geoffharcourt
geoffharcourt

Reputation: 320

It looks like your New Relic plugin may need to be updated to a new version. In your stacktrace, the first line is from the New Relic code in your plugins folder. From their site, it looks like they released new Rails 3.1-specific code:

http://blog.newrelic.com/2011/07/29/for-the-active-record-new-relic-support-for-rails-3-1-is-here/

In the blog post, they talk about changes to the way ActiveRecord does logging, and your exception was triggered on the log_with_instrumentation method.

It looks like now you should install it as a gem rather than a plugin: https://github.com/newrelic/rpm

Hope this helps.

Upvotes: 2

Related Questions