内部服务器错误:#string的未定义方法`symbolize_keys':0x0000000589bde0> </string:0x0000000589bde0>

时间:2015-02-17 00:35:51

标签: ruby-on-rails nitrousio

我讨厌提出一个问题,看起来之前已经被问了很多次,但我的情况似乎有所不同。我正在使用nitrous.io作为我的开发环境,当我尝试预览我的应用程序时,我收到此错误消息。

跟踪是:     错误NoMethodError:未定义的方法symbolize_keys' for #<String:0x0000000476d9b0>
/home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:327:in
秘密'
        /home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:461:in validate_secret_key_config!'
/home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:195:in
env_config'
        /home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/engine.rb:510:in call'
/home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:144:in
调用'
        /home/action/.rvm/gems/ruby-2.1.5/gems/rack-1.5.2/lib/rack/lock.rb:17:in call'
/home/action/.rvm/gems/ruby-2.1.5/gems/rack-1.5.2/lib/rack/content_length.rb:14:in
调用'
        /home/action/.rvm/gems/ruby-2.1.5/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in service'
/home/action/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/webrick/httpserver.rb:138:in
service'
        /home/action/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/webrick/httpserver.rb:94:in run'
/home/action/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/webrick/server.rb:295:in
阻止在start_thread'

我想我的密钥存在问题,但我不知道它是什么。我甚至不知道在这里提供什么其他信息!

如果有人有任何想法,我会很感激您的意见。 。 。

2 个答案:

答案 0 :(得分:3)

SPACE - 您的问题是缺少空格char。

WRONG: secret_key_base:afcb44c
CORRECT: secret_key_base: afcb44c

检查你的config / secrets.yml,它应该是这样的:

# Be sure to restart your server when you modify this file.

# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!

# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rake secret` to generate a secure secret key.

# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.

production:
  secret_key_base: 59834597551c797b02cd5bb3edd7439f7a9c604bc82531d51d6e5f995e6ea849deb545df53213c5fd2ce4d698edfca65c8aa1b4e0fbadd884efefae0348b079b

development:
  secret_key_base: aea4705f645128e053daf1f8511014aca3b1e28323c3ece75f228540fb310869a6c4aeac172783d1c5c8ec9c5fe9b7f7af9a0204714db29e1d2a6709fca65ebf

test:
  secret_key_base: afcb44cfa8eab1f23d19b87e327d0fcc42e7c1d2c681812b346b57901ddb2511ebde569a1b868da367e2de14554c648f723a30de3daada015bbd0b268beeda3b

# Do not keep production secrets in the repository,
# instead read values from the environment.
# production:
#   secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

此外,如果您需要生成新密钥,请使用以下命令:rake secret

所以请不要忘记在&#34;之后添加一个空格:&#34;。

答案 1 :(得分:2)

symbolize_keys方法是一种期望请求具有Hash数据类型的方法,但您的请求却是string。所以仔细检查你的代码。