birarda / logan

ruby gem to communicate with new Basecamp API
MIT License
16 stars 19 forks source link

Logan does not seems to work in production environment #16

Closed minhtriet closed 10 years ago

minhtriet commented 10 years ago

The following code works in development environment but not in production environment

    basecamp_ID = ENV['SL_BASECAMP_ID']
    auth_hash = { :username => "xxxx", :password => "xxxx" }

    user_agent = "LoganUserAgent (email@example.com)"
    @logan = Logan::Client.new(basecamp_ID, auth_hash, user_agent)
    begin
      session[:projects] = @logan.projects
      session[:logan] = @logan
      session[:current_user] = @logan.people.find {|person| person.email_address.include?(auth_hash[:username])}
    rescue => e
      e.backtrace
    end

Now @logan always return null

``NoMethodError (undefined methodpeople' for nil:NilClass):

birarda commented 10 years ago

This is a stupid question, but you've set that ENV on your production box, right?

minhtriet commented 10 years ago

I put that project in Heroku, so yes. Also, an export RAILS_ENV = production also destroys the app, and an export RAILS_ENV = development fixes it, I am currently set the environment to development in my server

mattherick commented 10 years ago

Do you have configured your ENV['SL_BASECAMP_ID'] correctly on production? Maybe you have an error in one of your configs or something is missing and the ID is nil?

birarda commented 10 years ago

@minhtriet so - using the heroku command line tools

heroku config:get SL_BASECAMP_ID shows you the correct ID?

minhtriet commented 10 years ago

heroku config:set SL_BASECAMP_ID="xxx" helped me solve the problems. Thank you very much and sorry for the false alarm

birarda commented 10 years ago

No problem @minhtriet, let me know if you run into any other issues or would like to submit a feature request!