Rails 4 - Devise: Getting Actioncontroller::Unknownformat on Signup

Rails 4 - Devise: getting ActionController::UnknownFormat on signup

Just change this in your form:

= form_for(resource, as: resource_name, url: user_registration_path) do |f|

user_registration_path does not requires an additional parameter, and you pass the resource_name to it, which is equal to user in your case. It gets interpreted as the format, and therefore you get url like http://localhost:3000/users.user (user is set as a format in this case).

ActionController::UnknownFormat in Devise::RegistrationsController#new. .user appended in URL

When you pass a resource into a path method such as new_user_registration_path, Rails will try to route to the action for that resource and interpolate it into the route. Since you don't have a route which has the matcher for the resource defined for it, Rails will just append .<resource.to_param> onto the end of the URL instead. Obviously this isn't what you want, since sign up doesn't need to take a resource.

The reason you're getting this specific exception is that because devise is attempting to respond to multiple response types (html, json, xml etc), it's parsing .user as the type you wish to receive, hence the unknown format error.

Rails 4 Devise 3.1.1 ActionController::UnknownFormat in Devise::RegistrationsController#new

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!

ActionController::UnknownFormat in RegistrationsController#create (Devise)

File uploads doesn't work with remote forms. You should use some other way to upload files.

For example;

  • https://github.com/JangoSteve/remotipart
  • https://github.com/tors/jquery-fileupload-rails

My suggestion is using remotipart.

Issues with Newly Installed Devise Login (ActionController::UnknownFormat in RegistrationsController#create)

It turned out that Devise autogenerated this for both registrations#new and sessions#new:

  <%= simple_form_for(resource, as: resource_name, url: user_registration_path(resource_name)) do |f| %>

The error disappeared when I removed (resource_name) on each form.

ActionController::UnknownFormat in Devise::SessionsController#new in rails 4

The main problem is with .47 at the end of url. Which might be your user id. But need to find where it come from. Might be there is some problem with your confirmation link.

As per your updated question please change following line in after_sign_up_or_sign_in_path_for method.

change this line User.where(id: resource.id).update_all(online: true) to resource.update_attribute(:online, true)



Related Topics



Leave a reply



Submit