Reputation: 4013
I am trying for long time and did google about the issue I am unable to get rid of it. Can any one explains why this is happening and how to resolve it.
def new
self.resource = resource_class.new(sign_in_params)
clean_up_passwords(resource)
respond_with(resource, serialize_options(resource))
end
The error is in the line following line respond_with(resource, serialize_options(resource))
When I register devise will send a confirmation link. When I click the link getting the above error and here is my url
http://localhost/users/sign_in.47
update 1
Here is my show action of confirmations_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 user as online once they logged in so i used resource.id that makes me trouble it seems
Upvotes: 3
Views: 2277
Reputation: 489
In your ApplicationController try and add this line if it's not already there:
respond_to :html, :json
Upvotes: 4
Reputation: 7366
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)
Upvotes: 1