lundi 30 novembre 2015

NoMethodError: undefined method `env' for nil:NilClass Rails Fix

I'm having issues now that i've added devise to my web app, theres a few SO questions on this but they just all point to a readme file and don't actually provide any fixes. I've had to include devise helpers as shown below in order to remove an issue saying the authentication method didn't exist

class ActiveSupport::TestCase
  # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
 fixtures :all

      # Add more helper methods to be used by all tests here...
  include Devise::TestHelpers
end

If i don't include it i end up with a huge amount of authentication errors:

ActionView::Template::Error: undefined method `authenticate' for nil:NilClass

but if it is included

 NoMethodError: undefined method `env' for nil:NilClass

Simply occurs in different places instead, is there an actual fix?

Thanks!

Aucun commentaire:

Enregistrer un commentaire