nameerror unitialized constant rails

时间:2017-11-14 16:11:28

标签: ruby-on-rails ruby-on-rails-5 elastic-beanstalk

我正在部署rails 5 api。经过很多线索错误后它几乎正常运作我遇到的问题是我遇到了500服务器错误。我对实例进行了检查以检查日志,并且我不断收到此名称错误。日志输出:

[2017-11-14T15:41:47.289647 #10484]  INFO -- : [6d21f1c2-6770-42a2-93be-cd68ee0441fc] Completed 500 Internal Server Error in 244ms (Views: 0.2ms | ActiveRecord: 3.6ms)
F, [2017-11-14T15:41:47.290161 #10484] FATAL -- : [6d21f1c2-6770-42a2-93be-cd68ee0441fc]
F, [2017-11-14T15:41:47.290225 #10484] FATAL -- : [6d21f1c2-6770-42a2-93be-cd68ee0441fc] NameError (uninitialized constant Net::HTTP):
F, [2017-11-14T15:41:47.290245 #10484] FATAL -- : [6d21f1c2-6770-42a2-93be-cd68ee0441fc]
F, [2017-11-14T15:41:47.290263 #10484] FATAL -- : [6d21f1c2-6770-42a2-93be-cd68ee0441fc] app/models/user.rb:41:in `authorization'
[6d21f1c2-6770-42a2-93be-cd68ee0441fc] app/models/user.rb:17:in `create_new_auth_token'

我以为我忘了要求net / http,但是当我检查require语句时已经存在了。我根本不理解这一点。此外,我检查了控制台,并显示包已包含在内。代码:

require "uri"
require "net/http"

def authorization(client_id, token)
        encrypted_token = Digest::SHA256.hexdigest(token)
        params = { "token": encrypted_token, "client": client_id }

        Net::HTTP.post_form(URI.parse("path to api"), params)
  end

有没有人对正在发生的事情有任何见解?

0 个答案:

没有答案