Rails 4 - Development: getting ActionController :: UnknownFormat upon registration

I have a Rails 4.2.3 application in which I use Devise to authenticate users. I submit my registration form in the Bootstrap module. I applied it as: https://github.com/plataformatec/devise/wiki/How-To:-Display-a-custom-sign_in-form-anywhere-in-your-app . During registration, I continue to receive this error:

Completed 406 Not Acceptable in 512033ms (ActiveRecord: 5.8ms)
ActionController::UnknownFormat (ActionController::UnknownFormat)

And I don’t know how to fix it.

I use custom controllers for sessionsand registrations. My routes currently look like this:

devise_for :users, :controllers => {sessions: "users/sessions", registrations: "users/registrations"}

get 'users/show', to: "users#show"
get 'users', to: "users#index"

My new user form looks like this: this is obtained in a partial, presented in the Bootstrap modal module:

= form_for(resource, as: resource_name, url:  user_registration_path(resource_name)) do |f|
  = devise_error_messages!
  .form-group
    = f.label :name
    = f.text_field :name, autofocus: true, class: "form-control"
  .form-group
    = f.label :email
    = f.email_field :email, class: "form-control"

  .form-group
    = f.label :password
    - if @minimum_password_length
      %em
        (#{@minimum_password_length} characters minimum)
    = f.password_field :password, autocomplete: "off", class: "form-control"

  .form-group
    = f.submit "Sign up", class: "btn btn-default"

- if current_page?(new_user_registration_path)
  = render "devise/shared/links" 

Application crash in my method Users::RegistrationsController < Devise::RegistrationsController create:

# POST /resource
def create
  # byebug
  super
end

URL- ( !):

http://localhost:3000/users.user

:

respond_to :json, :html

Users::RegistrationsController < Devise::RegistrationsController, .

gem bye bug , , :

# The path used after sign up.
def after_sign_up_path_for(resource)
  byebug
  session[:previous_url] || root_path # crashes here
end

session[:previous_url] "/apps/1/edit"

, , - ?

Sidenote ( ). : Rails 4 - Devise,

+4
1

:

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

user_registration_path , resource_name, user . , URL-, http://localhost:3000/users.user (user ).

+9

Source: https://habr.com/ru/post/1616973/


All Articles