Internal Server Error: undefined method `symbolize_keys' for #<String:0x0000000589bde0>
Internal Server Error: undefined method `symbolize_keys' for #<String:0x0000000589bde0>
我讨厌问一个看起来已经被问过很多次的问题,但我的情况似乎有所不同。我使用 nitrous.io 作为我的开发环境,当我尝试预览我的应用程序时,我收到此错误消息。
痕迹是:
错误 NoMethodError:#
的未定义方法 symbolize_keys'
/home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:327:in
secrets'
/home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:461:in validate_secret_key_config!'<br>
/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'<br>
/home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:144:in
call'
/home/action/.rvm/gems/ruby-2.1.5/gems/rack-1.5.2/lib/rack/lock.rb:17:in call'<br>
/home/action/.rvm/gems/ruby-2.1.5/gems/rack-1.5.2/lib/rack/content_length.rb:14:in
call'
/home/action/.rvm/gems/ruby-2.1.5/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in service'<br>
/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 运行'<br>
/home/action/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/webrick/server.rb:295:in
block in start_thread'
我想我的密钥有问题,但我不知道是什么问题。我什至不知道还有什么其他信息可以放在这里!
如果有人有任何想法,我将不胜感激。 . .
symbolize_keys
方法是一种期望请求具有 Hash
数据类型的方法,但您请求的是 string
。所以仔细检查你的代码。
SPACE - 您的问题是缺少 space 字符。
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
所以请不要忘记在“:”之后添加一个space。
我讨厌问一个看起来已经被问过很多次的问题,但我的情况似乎有所不同。我使用 nitrous.io 作为我的开发环境,当我尝试预览我的应用程序时,我收到此错误消息。
痕迹是:
错误 NoMethodError:#
的未定义方法 symbolize_keys'
/home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:327:in
secrets'
/home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:461:in validate_secret_key_config!'<br>
/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'<br>
/home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:144:in
call'
/home/action/.rvm/gems/ruby-2.1.5/gems/rack-1.5.2/lib/rack/lock.rb:17:in call'<br>
/home/action/.rvm/gems/ruby-2.1.5/gems/rack-1.5.2/lib/rack/content_length.rb:14:in
call'
/home/action/.rvm/gems/ruby-2.1.5/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in service'<br>
/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 运行'<br>
/home/action/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/webrick/server.rb:295:in
block in start_thread'
我想我的密钥有问题,但我不知道是什么问题。我什至不知道还有什么其他信息可以放在这里!
如果有人有任何想法,我将不胜感激。 . .
symbolize_keys
方法是一种期望请求具有 Hash
数据类型的方法,但您请求的是 string
。所以仔细检查你的代码。
SPACE - 您的问题是缺少 space 字符。
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
所以请不要忘记在“:”之后添加一个space。