2

I'm trying to sign up Users using Devise, and render a JS file if a certain parameter is included in the sign-up. I'm getting the following error:

ActionController::UnknownFormat in RegistrationsController#create
ActionController::UnknownFormat

This is my "create" action (I marked the line the error pointed to):

if resource.persisted?
  if resource.active_for_authentication?
    set_flash_message :notice, :signed_up if is_flashing_format?
    sign_up(resource_name, resource)
    if !params[:name].nil?
      View.create(name: params[:name])
      respond_to do |format| #THIS IS THE LINE WITH THE ERROR
        format.js
      end
    else
      respond_with resource, location: after_sign_up_path_for(resource)
    end
  else
    respond_with resource, location: inactive_path_for(resource)
  end
else
  respond_with resource
end

The action is "create", in app/controllers/registrations_controller.rb. The JS file I'm trying to render is app/views/devise/registrations/create.js.erb.

My suspicion is that there's a problem with finding the file, but I can't figure out how to point it to the right route, or if that's even the right problem. Anyone have any thoughts?

Eyeslandic
  • 14,553
  • 13
  • 41
  • 54
Joe Morano
  • 1,715
  • 10
  • 50
  • 114

0 Answers0