Rails 4.0.0, Devise 3.1.1, Warden 1.2.3
Upon clicking /users/sign_up.user link I get following exception:
Started GET "/users/sign_up.user" for 127.0.0.1 at 2013-10-04 21:58:39 -0400
Processing by Devise::RegistrationsController#new as
Completed 406 Not Acceptable in 1ms
ActionController::UnknownFormat (ActionController::UnknownFormat):
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'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.0) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.0) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/mapper.rb:44:in `call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:655:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.0) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__594484681__call__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
railties (4.0.0) lib/rails/engine.rb:511:in `call'
railties (4.0.0) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
/home/rehan/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/home/rehan/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/home/rehan/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
I was initially using Devise 3.0.0.rc when I got this exception, then I upgraded devise to 3.1.1 but the exception did not go away.
Devise puts resource_name in all the paths for link_to method in the views produced by devise... I had paths as following in my views:
new_user_registration_path(resource_name)
new_user_session_path(resource_name)
new_user_password_path(resource_name)
I removed resource_name from the paths which tells the link_to to use ".user" as format of the request and it fixed the problem. I wonder why Devise generator does that though?
Devise should not generate that. What devise generates is new_session_path(resource_name). Can you pinpoint a place where that is generated? Thanks.

it happened with us too,
the workaround was to add this line
respond_to :html, :json

it happened on devise 3.0.3 even though I had config.navigational_formats = ["_/_", :html, :json] set up (yes, initializers only run once)
and there were no confusions while generating a json URL,
our workaround worked great and all tests are passing now.

you can also try to add that line on Devise::RegistrationsController < DeviseController
I get a similar error when trying to update a users profile parameters:
What's with the users.5? How is the request format getting set to "5"?
Rails 4.0.2, Devise 3.2.4
Any help or suggestions would be greatly appreciated!
Thanks,
Dean Richardson
Started PUT "/users.5" for 127.0.0.1 at 2014-04-29 19:58:40 -0500
Processing by Users::RegistrationsController#update as
Parameters: {"utf8"=>"✓", "authenticity_token"=>"1C2vVm8YzTEeU33yuP/9ixWwdJ2CH/1uqQti7AAbFMA=", "user"=>{"first_name"=>"Dean", "last_name"=>"Richardson", "location"=>"Wilmette, Illinois"}, "commit"=>"Update"}
User Load (0.4ms) SELECT users.* FROM users WHERE users.id = 5 ORDER BY users.id ASC LIMIT 1
User Load (0.9ms) SELECT users.* FROM users WHERE users.id = 5 LIMIT 1
Completed 406 Not Acceptable in 97ms
ActionController::UnknownFormat - ActionController::UnknownFormat:
actionpack (4.0.2) lib/action_controller/metal/mime_responds.rb:372:in retrieve_collector_from_mimes'
actionpack (4.0.2) lib/action_controller/metal/mime_responds.rb:327:inrespond_with'
devise (3.2.4) app/controllers/devise/registrations_controller.rb:55:in update'
actionpack (4.0.2) lib/action_controller/metal/implicit_render.rb:4:insend_action'
actionpack (4.0.2) lib/abstract_controller/base.rb:189:in process_action'
actionpack (4.0.2) lib/action_controller/metal/rendering.rb:10:inprocess_action'
actionpack (4.0.2) lib/abstract_controller/callbacks.rb:18:in block in process_action'
activesupport (4.0.2) lib/active_support/callbacks.rb:443:in_run__3079944165231038599__process_action__callbacks'
activesupport (4.0.2) lib/active_support/callbacks.rb:80:in run_callbacks'
actionpack (4.0.2) lib/abstract_controller/callbacks.rb:17:inprocess_action'
actionpack (4.0.2) lib/action_controller/metal/rescue.rb:29:in process_action'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:31:inblock in process_action'
activesupport (4.0.2) lib/active_support/notifications.rb:159:in block in instrument'
activesupport (4.0.2) lib/active_support/notifications/instrumenter.rb:20:ininstrument'
activesupport (4.0.2) lib/active_support/notifications.rb:159:in instrument'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:30:inprocess_action'
actionpack (4.0.2) lib/action_controller/metal/params_wrapper.rb:245:in process_action'
activerecord (4.0.2) lib/active_record/railties/controller_runtime.rb:18:inprocess_action'
actionpack (4.0.2) lib/abstract_controller/base.rb:136:in process'
actionpack (4.0.2) lib/abstract_controller/rendering.rb:44:inprocess'
actionpack (4.0.2) lib/action_controller/metal.rb:195:in `dispatch'
...
I'm using a customized users/registrations_controller to handle permitted parameters for additional user fields and custom redirects after signup and update.
In my users/profile.html.erb form for updating a user's profile, I have:
<%= simple_form_for(@user, url: user_registration_path(@user), html: { method: :put }) do |f| %>
<div class="row">
<div class="large-12 columns">
<%= f.label :first_name, "First Name" %>
<%= f.text_field :first_name, :autofocus => true, :class => "radius" %>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<%= f.label :last_name, "Last Name" %>
<%= f.text_field :last_name, :class => "radius" %>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<%= f.label :location, "Where You Live" %>
<%= f.text_field :location, :placeholder => "e.g., Wilmette, Illinois", :class => "radius" %>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<%= f.label :avatar, "Upload a profile photo" %>
<%= f.file_field :avatar %>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<%= f.submit "Update", :class => "button radius alert" %>
</div>
</div>
<% end %>
@genlighten hey, sorry my comment was a bit shady,
would you try to add this lin in your ApplicationController?
it worked with us :+1:

Hi Thiago:
Unfortunately, I tried that already without success. I also tried putting
it in my users/registrations_controller with the same result.
I think the problem stems from me setting up a form that will submit its
data to a devise controller, but without using the resource, resource_name
objects in my simple_form_for.
The line in the devise/registrations_controller:55 that's triggering the
error says respond with resource and I suspect resource isn't defined
correctly or its format is not defined correctly.
Does that trigger any further ideas?
Thanks for your help!
--Dean
On Tue, Apr 29, 2014 at 10:20 PM, Thiago James Pinto <
[email protected]> wrote:
@genlighten https://github.com/genlighten hey, sorry my comment was a
bit shady,
would you try to add this lin in your ApplicationController?
it worked with us [image: :+1:][image: screen shot 2014-04-29 at 11 18 34 pm]https://cloud.githubusercontent.com/assets/335238/2837357/29c5d04c-d016-11e3-9310-d6d2d550c4c5.png
—
Reply to this email directly or view it on GitHubhttps://github.com/plataformatec/devise/issues/2667#issuecomment-41756912
.
oh, how did I not see it? such a common error :dart:
Started PUT "/users.5"
that is wrong, in many many ways =D
make a sample devise app in 5 minutes and see their forms, you're gonna find your answer, little grasshopper :bug: :+1:
I'm getting the same UnknownFormat for <user_model>_password_path. I agree, the problem is not the rise of the error but that dot and something at the end of the path. edit_<user_model>_password_path does it too. I fixed it by removing from the point to the end of the string:
showman_password_path(resource_name).sub(/\.[\w]*\z/, '')
In my password/edit.html.erb.
@eseca Thank you so much for that! You have saved me so much time. Can't believe I didn't think of that. I have been racking my brains for hours!
same problem in devise 4.2 and rails 4.2, the url is http://localhost:3000/users/confirmation.user
@thejamespinto hint worked perfectly for me, thanks!
I encountered the problem on password reset request: views/devise/passwords/new.html.haml
The problem was solved substituting user_password_path(resource_name) with user_password_path()
PD: my resource was name is "user"
I encountered the problem on password reset request: views/devise/passwords/new.html.haml
The problem was solved substituting
user_password_path(resource_name)withuser_password_path()PD: my resource was name is "user"
your solution worked for me. You bloody champ
Most helpful comment
it happened with us too,
the workaround was to add this line
respond_to :html, :jsonit happened on devise 3.0.3 even though I had config.navigational_formats = ["_/_", :html, :json] set up (yes, initializers only run once)
and there were no confusions while generating a json URL,
our workaround worked great and all tests are passing now.
you can also try to add that line on Devise::RegistrationsController < DeviseController