"undefined method `accept' for nil:NilClass" error after upgrading to 3.2

I’m getting the error undefined method `accept’ for nil:NilClass in my
controller. This is on the development environment running on OSX with
mysql. Below is the full stack trace and also my bundle/gem setup
information. This is reported by a couple of others on the ruby forums,
and
I’m trying to see who else might be running into this and if there is a
known solution.

( This info is also on this gist rails 3.2 errors · GitHub )

activerecord (3.2.0)
lib/active_record/connection_adapters/abstract/database_statements.rb:7:in
to_sql' activerecord (3.2.0) lib/active_record/connection_adapters/abstract/query_cache.rb:60:in select_all’
activerecord (3.2.0) lib/active_record/querying.rb:38:in block in find_by_sql' activerecord (3.2.0) lib/active_record/explain.rb:38:in logging_query_plan’
activerecord (3.2.0) lib/active_record/querying.rb:37:in find_by_sql' activerecord (3.2.0) lib/active_record/relation.rb:170:in exec_queries’
activerecord (3.2.0) lib/active_record/relation.rb:159:in block in to_a' activerecord (3.2.0) lib/active_record/explain.rb:31:in logging_query_plan’
activerecord (3.2.0) lib/active_record/relation.rb:158:in to_a' activerecord (3.2.0) lib/active_record/relation/finder_methods.rb:377:in find_first’
activerecord (3.2.0) lib/active_record/relation/finder_methods.rb:122:in
first' activerecord (3.2.0) lib/active_record/querying.rb:5:in first’
actionpack (3.2.0) lib/action_controller/metal.rb:246:in new' actionpack (3.2.0) lib/action_controller/metal.rb:246:in block in
action’
actionpack (3.2.0) lib/action_dispatch/routing/route_set.rb:66:in call' actionpack (3.2.0) lib/action_dispatch/routing/route_set.rb:66:in dispatch’
actionpack (3.2.0) lib/action_dispatch/routing/route_set.rb:30:in call' journey (1.0.0) lib/journey/router.rb:60:in block in call’
journey (1.0.0) lib/journey/router.rb:48:in each' journey (1.0.0) lib/journey/router.rb:48:in call’
actionpack (3.2.0) lib/action_dispatch/routing/route_set.rb:570:in
call' actionpack (3.2.0) lib/action_dispatch/middleware/best_standards_support.rb:17:in call’
rack (1.4.1) lib/rack/etag.rb:23:in call' rack (1.4.1) lib/rack/conditionalget.rb:25:in call’
actionpack (3.2.0) lib/action_dispatch/middleware/head.rb:14:in call' actionpack (3.2.0) lib/action_dispatch/middleware/params_parser.rb:21:in call’
actionpack (3.2.0) lib/action_dispatch/middleware/flash.rb:242:in call' rack (1.4.1) lib/rack/session/abstract/id.rb:205:in context’
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in call' actionpack (3.2.0) lib/action_dispatch/middleware/cookies.rb:338:in call’
activerecord (3.2.0) lib/active_record/query_cache.rb:64:in call' activerecord (3.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in call’
actionpack (3.2.0) lib/action_dispatch/middleware/callbacks.rb:28:in
block in call' activesupport (3.2.0) lib/active_support/callbacks.rb:405:in _run__359795530058627940__call__1911828153620681267__callbacks’
activesupport (3.2.0) lib/active_support/callbacks.rb:405:in
__run_callback' activesupport (3.2.0) lib/active_support/callbacks.rb:385:in _run_call_callbacks’
activesupport (3.2.0) lib/active_support/callbacks.rb:81:in
run_callbacks' actionpack (3.2.0) lib/action_dispatch/middleware/callbacks.rb:27:in call’
actionpack (3.2.0) lib/action_dispatch/middleware/reloader.rb:65:in
call' actionpack (3.2.0) lib/action_dispatch/middleware/remote_ip.rb:31:in call’
actionpack (3.2.0)
lib/action_dispatch/middleware/debug_exceptions.rb:16:in call' actionpack (3.2.0) lib/action_dispatch/middleware/show_exceptions.rb:56:in call’
railties (3.2.0) lib/rails/rack/logger.rb:26:in call_app' railties (3.2.0) lib/rails/rack/logger.rb:16:in call’
actionpack (3.2.0) lib/action_dispatch/middleware/request_id.rb:22:in
call' rack (1.4.1) lib/rack/methodoverride.rb:21:in call’
rack (1.4.1) lib/rack/runtime.rb:17:in call' activesupport (3.2.0) lib/active_support/cache/strategy/local_cache.rb:72:in call’
rack (1.4.1) lib/rack/lock.rb:15:in call' actionpack (3.2.0) lib/action_dispatch/middleware/static.rb:53:in call’
railties (3.2.0) lib/rails/engine.rb:479:in call' railties (3.2.0) lib/rails/application.rb:220:in call’
rack (1.4.1) lib/rack/content_length.rb:14:in call' railties (3.2.0) lib/rails/rack/log_tailer.rb:14:in call’
rack (1.4.1) lib/rack/handler/webrick.rb:59:in service' /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in service’
/usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in
run' /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in block in start_thread’

$ bundle show
Gems included by the bundle:

  • actionmailer (3.2.0)
  • actionpack (3.2.0)
  • activemodel (3.2.0)
  • activerecord (3.2.0)
  • activeresource (3.2.0)
  • activesupport (3.2.0)
  • annotate (2.4.0)
  • arel (3.0.0)
  • builder (3.0.0)
  • bundler (1.0.21)
  • coffee-rails (3.2.1)
  • coffee-script (2.2.0)
  • coffee-script-source (1.2.0)
  • erubis (2.7.0)
  • execjs (1.3.0)
  • hike (1.2.1)
  • i18n (0.6.0)
  • journey (1.0.0)
  • json (1.6.5)
  • mail (2.4.1)
  • mime-types (1.17.2)
  • multi_json (1.0.4)
  • mysql2 (0.2.6)
  • polyglot (0.3.3)
  • rabl (0.5.3)
  • rack (1.4.1)
  • rack-cache (1.1)
  • rack-ssl (1.3.2)
  • rack-test (0.6.1)
  • rails (3.2.0)
  • railties (3.2.0)
  • rake (0.9.2.2)
  • rdoc (3.12)
  • sass (3.1.12)
  • sass-rails (3.2.3)
  • simplecov (0.5.4)
  • simplecov-html (0.5.3)
  • sprockets (2.1.2)
  • thor (0.14.6)
  • tilt (1.3.3)
  • treetop (1.4.10)
  • tzinfo (0.3.31)
  • uglifier (1.2.2)

shyam

On Mon, Jan 23, 2012 at 15:57, Shyam H. [GMail]
[email protected] wrote:

I’m getting the errorundefined method `accept’ for nil:NilClassin my
controller.

At what line of code? Show us what’s there. Chances are you’ve got a
call that looks like “someobject.accept(someargs)”. The variable
someobject is nil. Trace down where that variable should have gotten
set, and see what you can figure out about why that didn’t happen, or
why the variable it got its value FROM was nil, or why it got RE-set,
to nil, afterward.

-Dave


Dave A., Available Cleared Ruby on Rails Freelancer
(NoVa/DC/Remote); details @ http://www.DaveAronson.com/.

Hi all

I’ve taking over the managing of a Rails system (v. 1.2.3) that has been
writing to production.log for several years now, and the log had grown
to 16 Gb, taking up half the server disc space.

I removed the logfile, doing:

$sudo mv production.log production.log.old
$sudo touch production.log
$sudo chmod 666 production.log
$sudo rm production.log.old

Everything works fine except my new log file does not get written to. Is
there any way to restart logging without restarting Rails? The server is
running several Ruby components as well, defined in /lib, and they also
write to the production log.

Will I need to restart the Ruby components - or is it sufficient to kill
the Rails processes and restart them?

I’ve enclosed a section of ps aux output

root 23654 0.0 1.0 26952 21984 ? S Apr26 24:51
phone_tcp_server.rb_monitor
root 23655 0.3 7.2 155376 149668 ? S Apr26 995:25
phone_tcp_server.rb
root 23675 0.0 1.0 27212 22140 ? S Apr26 25:28
ast_ami_amq.rb_monitor
root 23677 0.2 1.0 27220 21760 ? S Apr26 688:09
ast_ami_amq.rb
root 23813 0.0 0.4 12864 9452 ? S Apr26 0:52 ruby
queuepause_server.rb
root 9279 0.0 1.9 45948 40552 ? S Nov21 7:19
ruby
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails start
-d -e
production -p 8000 -a 127.0.0.1 -P log/mongrel.8000.pid -c
/home/rails_apps/netklinik.dk/current
-m/home/rails_apps/netklinik.dk/current/config/mime_types.yml
root 9317 0.0 2.0 47124 41696 ? S Nov21 7:25
ruby
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails start
-d -e
production -p 8001 -a 127.0.0.1 -P log/mongrel.8001.pid -c
/home/rails_apps/netklinik.dk/current
-m/home/rails_apps/netklinik.dk/current/config/mime_types.yml

Any help and guidance would be greatly appreciated!

Best regards

Binni

ITAnet
Kirkestien 20
9230 Svenstrup

Telefon: 3020 0868

Email: [email protected]
WWW: http://www.itanet.nu