Devise中的ActionController :: UrlGenerationError :: Registrations #create

时间:2015-02-27 23:03:03

标签: ruby-on-rails devise ruby-on-rails-4.1 rails-i18n devise-confirmable

我是Rails的新手,我不知道如何处理错误,请帮忙(有解释):

Devise中的ActionController :: UrlGenerationError :: Registrations #create

显示/home/ubuntu/workspace/mamchut418/app/views/devise/mailer/confirmation_instructions.html.erb第5行引发:

没有路由匹配{:action =>“create”,:confirmation_token =>“24GGcednzrEXEzaR82AC”,:controller =>“devise / confirmations”}缺少必需的键:[:locale]

提取的来源(第5行):

3 | <p><%= _('You can confirm your account email through the link below:') %>p>
4 |
5 | <p><%= link_to _('Confirm my account'), confirmation_url(@resource, confirmation_token: @token) %></p>

app / views / devise / mailer / confirmation_instructions.html.erb:5:in`_app_views_devise_mailer_confirmation_instructions_html_erb ___ 1326125006769773887_55918960'

请求

参数:

{"utf8"=>"✓",
"authenticity_token"=>"pY7ApWH/WTOVTFGifeV7QbubuNch/EzCJWjaXg7t+i5iYpI=",
"user"=>{"email"=>"qwerty@gmail.com",
"password"=>"[FILTERED]",
"password_confirmation"=>"[FILTERED]"},
"commit"=>"Registrovať",
"locale"=>"sk"}

会话转储

_csrf_token: "pY7ApWH/WTkukoOVTFGifeV7QNch/EzCJWjaXg7t+i5iYpI="
locale: "sk"
session_id: "01f6f1f89089a5ef29326e80b0d44f79"

1 个答案:

答案 0 :(得分:1)

这是一个i18n(国际化)问题,需要知道yoru语言环境是什么。在config / application.rb文件中指定国际化的默认语言环境

config.i18n.default_locale = :en

或者你想要斯洛伐克

config.i18n.default_locale = :sk

修改

您还可以在调用confirmation_url方法时指定区域设置...

<p><%= link_to _('Confirm my account'), confirmation_url(@resource, confirmation_token: @token, locale: 'en') %></p>