0

I have an application working in localhost and also heroku. The last time that I pushed the new version to heroku I got an error during heroku db:migrate and did heroku db:push and everything was ok.

I get the following error when executing the App. /app/.bundle/gems/ruby/1.9.1/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing_from_s3_library': uninitialized constant AnswersController::Authentication (NameError)

Here is the relevant code

class AnswersController < ApplicationController
  include Authentication
  ...

Authentication is a module defined in lib:

# encoding: utf-8
require 'base64'
require 'openssl'

module Authentication
...

It is working in localhost but not in heroku. Any help?? Thanks

Tony
  • 10,088
  • 20
  • 85
  • 139

1 Answers1

0

Try adding the lib folder to your the config.auto_load path in application.rb

config.autoload_paths += %W(#{config.root}/lib)

Also, take a look at this link.

Matt
  • 17,290
  • 7
  • 57
  • 71
  • I don't know why it works in development but crashes in heroku =( – Tony Feb 08 '12 at 15:09
  • What happens if you run your application locally in production mode? – Matt Feb 08 '12 at 15:10
  • What is the filename in which the module is defined? (It should be `authentication.rb`) – Matt Feb 08 '12 at 15:17
  • It was Authentication.rb but I changed it to authentication.rb and it didn't worked... – Tony Feb 08 '12 at 15:17
  • 1
    Sorry, running out of ideas. As a last resort you could try to drop the file into the `app/models` folder. – Matt Feb 08 '12 at 15:26
  • Thanks, I am trying to create an entire new heroku application – Tony Feb 08 '12 at 15:53
  • It worked running my module to the models folder,,, WHY??? Why heroku isn't loading my lib modules???? – Tony Feb 08 '12 at 16:30
  • 1
    From what I've seen so far while googling, there seems to be a weird issue with loading paths on Heroku. There is a similar question to yours on SO: http://stackoverflow.com/questions/5477431/rails-heroku-does-not-load-my-lib . Unfortunately I don't have a lot of experience with Heroku. I suggest you contact the Heroku support regarding your issue: http://devcenter.heroku.com/categories/support . – Matt Feb 08 '12 at 19:48
  • I had tryied what is discussed in that thread. It says to also 'require' the module. Anyway, thank you very much for your help. – Tony Feb 09 '12 at 13:52