Rails 4 Devise 3.1.1 ActionController :: UnknownFormat in Devise :: RegistrationsController#new [英] Rails 4 Devise 3.1.1 ActionController::UnknownFormat in Devise::RegistrationsController#new

查看:248
本文介绍了Rails 4 Devise 3.1.1 ActionController :: UnknownFormat in Devise :: RegistrationsController#new的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Devise 3.1.1进行Rails 4应用程序的用户验证。当我点击/users/sign_up.user链接Rails抛出以下异常:

  ActionController :: UnknownFormat in Devise :: RegistrationsController#新
ActionController :: UnknownFormat

Rails.root:/ home / rehan / odesk_work / kiefer-waight / ujoin / ujoin-www

应用程序跟踪|框架跟踪|完整跟踪
actionpack(4.0.0)lib / action_controller / metal / mime_responds.rb:372:在`retrieve_collector_from_mimes'
actionpack(4.0.0)lib / action_controller / metal / mime_responds.rb:327:在`respond_with'
devise(3.1.1)app / controllers / devise / registrations_controller.rb:8:in`new'
actionpack(4.0.0)lib / action_controller / metal / implicit_render.rb: 4:在`send_action'
actionpack(4.0.0)lib / abstract_controller / base.rb:189:在'process_action'
actionpack(4.0.0)lib / action_controller / metal / rendering.rb: 10:在'process_action'
actionpack(4.0.0)lib / abstract_controller / callbacks.rb:18:在'block in process_action'
activesupport(4.0.0)lib / active_support / callbacks.rb: 413:在`_run__890637270__process_action__callbacks'
....

我实际上是Devise 3.0。 0.rc当启动应用程序时,我认为升级到3.1.1可能会解决问题,但没有。在SO / google / devise github项目中找不到任何有用的东西。任何想法如何解决它。谢谢!

解决方案

我不想更改Devise生成的默认链接,后者在每个链接的末尾附加了.user 。 Devise生成以下链接:



new_user_registration_path(resource_name)new_user_session_path(resource_name)new_user_password_path(resource_name)

$作为link_to方法中的路径的参数,resource_name是用户,它指示它将.user用作格式。所以我刚从每个路径删除resource_name。我不知道为什么Devise这样做呢!


I am working on a Rails 4 app using Devise 3.1.1 for user authentication. When I click on /users/sign_up.user link Rails throws following exception:

ActionController::UnknownFormat in Devise::RegistrationsController#new
ActionController::UnknownFormat

Rails.root: /home/rehan/odesk_work/kiefer-waight/ujoin/ujoin-www

Application Trace | Framework Trace | Full Trace
actionpack (4.0.0) lib/action_controller/metal/mime_responds.rb:372:in `retrieve_collector_from_mimes'
actionpack (4.0.0) lib/action_controller/metal/mime_responds.rb:327:in `respond_with'
devise (3.1.1) app/controllers/devise/registrations_controller.rb:8:in `new'
actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.0.0) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (4.0.0) lib/active_support/callbacks.rb:413:in `_run__890637270__process_action__callbacks'
....

I was actually on Devise 3.0.0.rc when started the app, I thought upgrading the devise to 3.1.1 might solve the problem, but it didn't. Couldn't find anything useful on SO/google/devise github project. Any idea how to work around it. Thanks!

解决方案

I did not want to change default links produced by Devise which appended ".user" at the end of each link. Devise produced following links:

new_user_registration_path(resource_name) new_user_session_path(resource_name) new_user_password_path(resource_name)

resource_name, which is user, as parameter to the path in link_to method which tells it to use ".user" as format. So I just removed resource_name from each path. I wonder why Devise does this though!

这篇关于Rails 4 Devise 3.1.1 ActionController :: UnknownFormat in Devise :: RegistrationsController#new的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆