ActionController :: UnknownFormat in Devise :: SessionController # new in rails 4
I have been trying for a long time and did google about the problem, I cannot get rid of it. Can anyone please explain why this is happening and how to solve it.
def new
self.resource = resource_class.new(sign_in_params)
clean_up_passwords(resource)
respond_with(resource, serialize_options(resource))
end
Error on line following response_with (resource, serialize_options (resource))
When I register the program, you will send a confirmation link. When I click on the link getting the above error and here is my url
http://localhost/users/sign_in.47
update 1
Here is my action show confirms_controller.rb
def show
self.resource = resource_class.confirm_by_token(params[:confirmation_token])
yield resource if block_given?
if resource.errors.empty?
set_flash_message(:notice, :confirmed) if is_flashing_format?
respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) }
else
respond_with_navigational(resource.errors, status: :unprocessable_entity){ render :new }
end
end
def after_sign_up_or_sign_in_path_for resource
User.where(id: resource.id).update_all(online: true)
dashboard_path
end
I need to update the user as online as soon as they are logged in, so I used resource.id, which makes me worry.
source to share
The main problem is at .47
the end of the url. What your user id might be. But you need to find where it came from. There may be some issues with your verification link.
As per your updated question, please change the following line in the method after_sign_up_or_sign_in_path_for
.
change this line User.where (id: resource.id) .update_all (online: true) to resource.update_attribute (: online, true)
source to share