NoMethodError - I'm stuck, please help

26 views
Skip to first unread message

Levi Rosol

unread,
Nov 18, 2009, 9:38:23 AM11/18/09
to communi...@googlegroups.com
I've spent a ton of time on this bug, and am looking for any help I can get. Last week I started seeing an issue where my site started throwing NoMethod errors on a particular controller. The odd thing is that I only see this error in production. In development everything works exactly as expected.

Looking at my logs I can see specifically when the error started showing, but there were no code changes prior to that date.

The error is when I view any of my group pages. index, edit, and show all error on the first method they try to call. They each point to a different method that I have confirmed is in my groups.rb file.

The site is hosted on webbynode.

Because everything works fine in dev, I was leaning toward it being a db issue. So, i created a new db, pointed my prod site to it, ran the migrations, but still saw the exact same error.

Does anyone have some suggestions as to what I should look at? could it be a config setting?

I can post some of the logs tonight, but i really don't think they will help.

--
Levi Rosol
Twitter: @LeviRosol

Jim Ruther Nill

unread,
Nov 18, 2009, 9:54:53 AM11/18/09
to communi...@googlegroups.com
accidentally removed a line in routes file?


--

You received this message because you are subscribed to the Google Groups "CommunityEngine" group.
To post to this group, send email to communi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/communityengine?hl=.



--
"We do not believe in ourselves until someone reveals that deep inside us is valuable, worth listening to, worthy of our trust, sacred to our touch." - E. E. Cummings

Levi Rosol

unread,
Nov 18, 2009, 10:13:27 AM11/18/09
to communi...@googlegroups.com
pretty sure that's not the case, but it's worth a second look.


--
Levi Rosol
Twitter: @LeviRosol



Bruno Bornsztein

unread,
Nov 18, 2009, 10:21:00 AM11/18/09
to communi...@googlegroups.com
Looks like some kind of code reloading problem. Can you post a stack trace?
Thanks,
Bruno

Levi Rosol

unread,
Nov 18, 2009, 10:25:44 AM11/18/09
to communi...@googlegroups.com
I can (tonight when i get home), but depending on the view you go to, you get a different error. All of them being NoMethod errors, but each point to the first method that the view is trying to call.

It's almost as if it cannot find the model.

btw, I do fully expect this to result in "forehead smack" type issue. It has to be something silly.


--
Levi Rosol
Twitter: @LeviRosol



Levi Rosol

unread,
Nov 20, 2009, 12:27:57 AM11/20/09
to communi...@googlegroups.com
so going off of the posts in the other somewhat related thread, i started looking into some code that was recently added by another dev. I found a situation where there was a new control, team.rb, that was overriding the group controller. This was what was causing me error.

It's important to note that the only way i could reproduce it in dev is to set
config.cache_classes = true
in the development.rb. With it set to false, everything ran just fine.

I seem to remember a thread from many months back where people (myself included) were having similar errors, but only in dev, related to the aws-s3 logic.

hope this helps someone down the road.


--
Levi Rosol
Twitter: @LeviRosol



mike muldoon

unread,
Nov 20, 2009, 12:38:43 AM11/20/09
to communi...@googlegroups.com
Referring to the "In Production, the Strange Error 'undefined method
`controller_name' for nil:NilClass' is Back" thread of the past day or
so, did you have a cache_sweeper directive in the overridden
controller?

I had a similar bug, with a similar hack-fix, namely setting
config.action_controller.perform_caching to false.

I had cache_sweeper directives in both the CE and overridden
controllers. Eliminating it from the overridden controller was the
fix.

Levi Rosol

unread,
Nov 20, 2009, 12:45:13 AM11/20/09
to communi...@googlegroups.com
nope, the only thing the overridden model had in it was:

  has_many :home_games,     :class_name => "Game", :foreign_key => :home_team_id
  has_many :visitors_games, :class_name => "Game", :foreign_key => :visiting_team_id



--
Levi Rosol
Twitter: @LeviRosol



Mike Muldoon

unread,
Nov 20, 2009, 2:21:35 AM11/20/09
to communi...@googlegroups.com, communi...@googlegroups.com
Is there any overridden controller logic?

Audrey A Lee

unread,
Nov 27, 2009, 3:02:18 AM11/27/09
to CommunityEngine
I too have bumped into this nil:NilClass (NoMethodError)

Everything works fine in development.

But script/server coughs up an error when I
export RAILS_ENV=production

I've overridden these controllers:

application_controller.rb
posts_controller.rb
users_controller.rb

More info which I got from my development environment since
script/about will not run on production:

[oracle@ion c]$
[oracle@ion c]$
[oracle@ion c]$ script/about
/home/pt/c/vendor/plugins/community_engine/app/controllers/
users_controller.rb:17: undefined method `merge' for nil:NilClass
(NoMethodError)
from /r2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `gem_original_require'
from /r2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `require'
from /home/pt/c/vendor/rails/activesupport/lib/active_support/
dependencies.rb:158:in `require_without_desert'
from /home/pt/c/vendor/gems/desert-0.5.3/lib/desert/ruby/
object.rb:8:in `require'
from /home/pt/c/vendor/gems/desert-0.5.3/lib/desert/ruby/object.rb:
32:in `__each_matching_file'
from /home/pt/c/vendor/gems/desert-0.5.3/lib/desert/ruby/
object.rb:7:in `require'
from /home/pt/c/vendor/rails/activesupport/lib/active_support/
dependencies.rb:265:in `require_or_load'
from /home/pt/c/vendor/gems/desert-0.5.3/lib/desert/rails/
dependencies.rb:27:in `depend_on'
... 14 levels...
from /home/pt/c/vendor/rails/railties/lib/commands/about.rb:1
from /r2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `gem_original_require'
from /r2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `require'
from script/about:4
[oracle@ion c]$ export RAILS_ENV=development
[oracle@ion c]$ script/about
/home/pt/c/vendor/gems/rack-1.0.1/lib/rack/utils.rb:29: warning:
already initialized constant DEFAULT_SEP
/home/pt/c/vendor/gems/rack-1.0.1/lib/rack/utils.rb:285: warning:
already initialized constant HTTP_STATUS_CODES
/home/pt/c/vendor/gems/rack-1.0.1/lib/rack/utils.rb:289: warning:
already initialized constant STATUS_WITH_NO_ENTITY_BODY
/home/pt/c/vendor/gems/rack-1.0.1/lib/rack/utils.rb:296: warning:
already initialized constant EOL
About your application's environment
Ruby version 1.8.6 (i686-linux)
RubyGems version 1.3.1
Rack version 1.0
Rails version 2.3.4
Active Record version 2.3.4
Active Resource version 2.3.4
Action Mailer version 2.3.4
Active Support version 2.3.4
Edge Rails revision 0e8164cda389c2d0a5d1327a2b16db601a0107ad
Application root /home/pt/c
Environment development
Database adapter mysql
Database schema version 20091120045512
[oracle@ion c]$
[oracle@ion c]$

[oracle@ion c]$
[oracle@ion c]$ cd vendor/plugins/community_engine/
[oracle@ion community_engine]$
[oracle@ion community_engine]$ git log -1
commit e5682d22f6724bd2c13d9e60835febe6f6c4f823
Author: bborn <bruno.bo...@gmail.com>
Date: Mon Sep 21 10:51:33 2009 -0500

add nice regex to upgrading instructions for migration fixesc
[oracle@ion community_engine]$
[oracle@ion community_engine]$

Audrey A Lee

unread,
Nov 27, 2009, 3:44:42 AM11/27/09
to CommunityEngine
ok,

I was able to easily work-around this bug.

I can now run my site under RAILS_ENV=production

All I did was move my controllers out of RR/app/controllers/ down
inside of vendor/plugins/community_engine/app/controllers/

Now RR/app/controllers/ is empty.

This appeals to me.

I dont like have controllers in two places.

--Audrey

Bruno Bornsztein

unread,
Nov 27, 2009, 10:23:58 AM11/27/09
to communi...@googlegroups.com
Sorry, that's really not the best approach. This has been discussed in many threads before (and it's fixed in edge), but the right way to work around this is to use an initializer:

http://gist.github.com/216991

Moving all the CE controllers to your app directory is not the correct way to solve this problem.

Thanks,
Bruno

--

You received this message because you are subscribed to the Google Groups "CommunityEngine" group.
To post to this group, send email to communi...@googlegroups.com.
To unsubscribe from this group, send email to communityengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/communityengine?hl=en.



Audrey A Lee

unread,
Nov 27, 2009, 5:07:26 PM11/27/09
to CommunityEngine
Bruno,

thanks for your help with this.

I appreciate your efforts.

I moved my controllers back to RR/app/controllers.

I replaced vendor/plugins/community_engine with edge.

I now see this:

Fri Nov 27 13:52 /pt/c/vendor/plugins/community_engine maco$
Fri Nov 27 13:52 /pt/c/vendor/plugins/community_engine maco$
Fri Nov 27 13:52 /pt/c/vendor/plugins/community_engine maco$
Fri Nov 27 13:52 /pt/c/vendor/plugins/community_engine maco$ git log
-1
git log -1
commit c101028c576e1552184b8463cd5f38dac2b65473
Author: bborn <bruno.bo...@gmail.com>
Date: Fri Nov 20 11:16:40 2009 -0600

fix install template
Fri Nov 27 13:52 /pt/c/vendor/plugins/community_engine maco$ git br
* edge
master
Fri Nov 27 13:52 /pt/c/vendor/plugins/community_engine maco$
Fri Nov 27 13:52 /pt/c/vendor/plugins/community_engine maco$
Fri Nov 27 13:52 /pt/c/vendor/plugins/community_engine maco$
Fri Nov 27 13:52 /pt/c/vendor/plugins/community_engine maco$


Then I did this:



Fri Nov 27 13:33 /pt/c maco$
Fri Nov 27 13:33 /pt/c maco$
Fri Nov 27 13:33 /pt/c maco$
Fri Nov 27 13:34 /pt/c maco$ script/generate plugin_migration
/Users/maco/pt/webprops/c1cme/c10/vendor/gems/rack-1.0.1/lib/rack/
utils.rb:29: warning: already initialized constant DEFAULT_SEP
/Users/maco/pt/webprops/c1cme/c10/vendor/gems/rack-1.0.1/lib/rack/
utils.rb:285: warning: already initialized constant HTTP_STATUS_CODES
/Users/maco/pt/webprops/c1cme/c10/vendor/gems/rack-1.0.1/lib/rack/
utils.rb:289: warning: already initialized constant
STATUS_WITH_NO_ENTITY_BODY
/Users/maco/pt/webprops/c1cme/c10/vendor/gems/rack-1.0.1/lib/rack/
utils.rb:296: warning: already initialized constant EOL
---
[COMMUNITY ENGINE] You have 2 pending CommunityEngine migrations:
CE is at 72, but you have only migrated it to 70
Please run 'script/generate plugin_migration' AND 'rake db:migrate'
before continuing, or you will experience errors.
---
exists db/migrate
create db/migrate/
20091127213504_community_engine_to_version_72.rb
Fri Nov 27 13:35 /pt/c maco$
Fri Nov 27 13:35 /pt/c maco$
Fri Nov 27 13:35 /pt/c maco$
Fri Nov 27 13:35 /pt/c maco$
Fri Nov 27 13:35 /pt/c maco$



Fri Nov 27 13:35 /pt/c maco$
Fri Nov 27 13:35 /pt/c maco$
Fri Nov 27 13:35 /pt/c maco$
Fri Nov 27 13:35 /pt/c maco$
Fri Nov 27 13:35 /pt/c maco$
Fri Nov 27 13:35 /pt/c maco$ ll db/migrate/
20091127213504_community_engine_to_version_72.rb
-rw-r--r-- 1 maco staff 196 Nov 27 13:35 db/migrate/
20091127213504_community_engine_to_version_72.rb
Fri Nov 27 13:35 /pt/c maco$
Fri Nov 27 13:35 /pt/c maco$ cat db/migrate/
20091127213504_community_engine_to_version_72.rb
class CommunityEngineToVersion72 < ActiveRecord::Migration
def self.up
migrate_plugin(:community_engine, 72)
end

def self.down
migrate_plugin(:community_engine, 70)
end
end
Fri Nov 27 13:36 /pt/c maco$
Fri Nov 27 13:36 /pt/c maco$
Fri Nov 27 13:36 /pt/c maco$
Fri Nov 27 13:36 /pt/c maco$
Fri Nov 27 13:36 /pt/c maco$
Fri Nov 27 13:36 /pt/c maco$


Fri Nov 27 13:36 /pt/c maco$
Fri Nov 27 13:36 /pt/c maco$
Fri Nov 27 13:36 /pt/c maco$
Fri Nov 27 13:36 /pt/c maco$
Fri Nov 27 13:36 /pt/c maco$ rake db:migrate
rake db:migrate
(in /Users/maco/pt/webprops/c1cme/c10)
== CommunityEngineToVersion72: migrating
=====================================
== AuthlogicCompatibilityChanges: migrating
==================================
-- change_column(:users, :crypted_password, :string, {:limit=>255})
-> 0.1791s
-- change_column(:users, :salt, :string, {:limit=>255})
-> 0.1777s
-- rename_column(:users, :salt, :password_salt)
-> 0.0874s
-- rename_column(:users, :remember_token, :persistence_token)
-> 0.1886s
-- remove_column(:users, :remember_token_expires_at)
-> 0.0880s
-- change_table(:users)
-> 0.0052s
-- add_index(:users, :login)
-> 0.0004s
-- add_index(:users, :persistence_token)
-> 0.0003s
-- add_index(:users, :last_request_at)
-> 0.0003s
== AuthlogicCompatibilityChanges: migrated (0.7278s)
=========================

== AddAllowRsvpToEvents: migrating
===========================================
-- add_column(:events, :allow_rsvp, :boolean, {:default=>true})
-> 0.0006s
== AddAllowRsvpToEvents: migrated (0.0007s)
==================================

== CommunityEngineToVersion72: migrated (1.2440s)
============================

Fri Nov 27 13:37 /pt/c maco$
Fri Nov 27 13:37 /pt/c maco$
Fri Nov 27 13:37 /pt/c maco$
Fri Nov 27 13:37 /pt/c maco$
Fri Nov 27 13:37 /pt/c maco$


Fri Nov 27 13:44 /pt/c maco$
Fri Nov 27 13:44 /pt/c maco$
Fri Nov 27 13:44 /pt/c maco$
Fri Nov 27 13:44 /pt/c maco$
Fri Nov 27 13:44 /pt/c maco$ script/server --debugger
=> Booting Mongrel
=> Rails 2.3.4 application starting on http://0.0.0.0:3000
/Users/maco/pt/webprops/c1cme/c10/vendor/gems/rack-1.0.1/lib/rack/
mime.rb:201: warning: already initialized constant MIME_TYPES
=> Debugger enabled
=> Call with -d to detach
=> Ctrl-C to shutdown server
SQL (3.4ms) SELECT name
FROM sqlite_master
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
SQL (1.5ms) SELECT name
FROM sqlite_master
WHERE type = 'table' AND NOT name = 'sqlite_sequence'


Processing ApplicationController#prompt4post (for 127.0.0.1 at
2009-11-27 13:45:44) [GET]

NoMethodError (undefined method `acts_as_authentic' for #<Class:
0x3f6108c>):

I'm looking for any clues on how to fix this error:

NoMethodError (undefined method `acts_as_authentic' for #<Class:
0x3f6108c>):

Thanks,
--Audrey


On Nov 27, 7:23 am, Bruno Bornsztein <bruno.bornszt...@gmail.com>
wrote:
> Sorry, that's really not the best approach. This has been discussed in many
> threads before (and it's fixed in edge), but the right way to work around
> this is to use an initializer:
>
> http://gist.github.com/216991
>
> Moving all the CE controllers to your app directory is not the correct way
> to solve this problem.
>
> Thanks,
> Bruno
>
Reply all
Reply to author
Forward
0 new messages