Authlogic problem in production mode: undefined local variable or method `acts_as_authentic' for class name
I'm using the AuthLogic gem in my rails app. It works fine in the development environment but when I switch to production environment, I get an error preventing the app from starting:
/home/.../rails/xxx/app/models/book.rb:2: undefined local variable or method `acts_as_authentic' for Book:Class (NameError)
from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /home/.../ruby/gems/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:158:in `require'
from /home/.../ruby/gems/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:265:in `require_or_load'
from /home/.../ruby/gems/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:224:in `depend_on'
from /home/.../ruby/gems/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:136:in `require_dependency'
from /home/.../ruby/gems/gems/rails-2.3.8/lib/initializer.rb:414:in `load_application_classes'
from /home/.../ruby/gems/gems/rails-2.3.8/lib/initializer.rb:413:in `each'
from /home/.../ruby/gems/gems/rails-2.3.8/lib/initializer.rb:413:in `load_application_classes'
from /home/.../ruby/gems/gems/rail开发者_如何学运维s-2.3.8/lib/initializer.rb:411:in `each'
from /home/.../ruby/gems/gems/rails-2.3.8/lib/initializer.rb:411:in `load_application_classes'
from /home/.../ruby/gems/gems/rails-2.3.8/lib/initializer.rb:197:in `process'
from /home/.../ruby/gems/gems/rails-2.3.8/lib/initializer.rb:113:in `send'
from /home/.../ruby/gems/gems/rails-2.3.8/lib/initializer.rb:113:in `run'
from ./public/../config/environment.rb:28
from ./public/dispatch.fcgi:21:in `require'
from ./public/dispatch.fcgi:21
I'm using authlogic (2.1.5) and rails (2.3.8)
The error only happens in the production environment, even though my production and dev DB's are identical. Same issue on localhost as on the web server. I would really appreciate any help I can get with this. Please let me know if more info is needed. Much thanks!
Edited Sept 15: Thanks for the replies. It's frozen into my application. I'm not sure how to verify that it's installed in such a way as to be available to the user I run my web server as. Here is the output of rake gems RAILS_ENV=production :
rake gems RAILS_ENV=production
(in /Users/my_user_name/Sites/my_app_name)
- [F] authlogic
- [R] activesupport
- [F] acts-as-taggable-on = 2.0.0.rc1
- [R] rails
- [F] will_paginate
- [I] nokogiri
I = Installed
F = Frozen
R = Framework (loaded before rails starts)
Edited Sept 17: I tried unfreezing the gems and got the same error.
Is the authlogic gem installed in your production environment or frozen into your application? Also, is it installed in such a way as to be available to the user you run your web server as? (Apologies if you've already checked this but it makes sense to start at the beginning)
Finally, it would be worth checking that your config.gem "authlogic"
call in environment.rb is before any use of your Book
class which appears to be causing the problem.
精彩评论