ActionController::UrlGenerationError in Devise::Registrations#create

泄露秘密 提交于 2019-12-08 11:37:21

问题


I'm newbie in Rails and I don't know what to do with tis error, please help (with explanation):

ActionController::UrlGenerationError in Devise::Registrations#create

Showing /home/ubuntu/workspace/mamchut418/app/views/devise/mailer/confirmation_instructions.html.erb where line #5 raised:

No route matches {:action=>"create", :confirmation_token=>"24GGcednzrEXEzaR82AC", :controller=>"devise/confirmations"} missing required keys: [:locale]

Extracted source (around line #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'

Request

Parameters:

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

Session dump

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

回答1:


This is an i18n (internationalization) issue, where it needs to know what yoru locale is. Specify the default locale for your internationalization in your config/application.rb file

config.i18n.default_locale = :en

or perhaps you want Slovak

config.i18n.default_locale = :sk

EDIT

You can also specify the locale when you call the confirmation_url method...

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


来源:https://stackoverflow.com/questions/28775825/actioncontrollerurlgenerationerror-in-deviseregistrationscreate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!