You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This stack overflow question was posted earlier before I realized that devise_token_auth was searching for member to create new headers because the current_user had not been signed out. I tried doing sign_out current_user which returned an empty hash but still returned the same 404 error. Am I missing something?
This is my member controller:
def destroy
begin
@member = Member.find(member_params[:id])
authorize @member
@member.destroy
render json: {}, status: :no_content
rescue Pundit::NotAuthorizedError
@member.errors.add(:id, :forbidden, message: "current user is not authorized to delete member id: #{params[:id]}")
render :json => { errors: @member.errors.full_messages }, :status => :forbidden
rescue ActiveRecord::RecordNotFound
render :json => {}, :status => :not_found
end
end
def member_params
params.require(:member).permit(:id, :attributes =>[:avatar, :name, :surname, :nickname, :gender, :bio, :birthday, :instagram, :email, :addresses => [:type, "line-1", "line-2", :city, :state, :postal], :contacts => [:home, :work, :cell] ])
end
Version: which version of this gem (and [ng-token-auth]
Latest gem version
SQL Log Right before Stacktrace:
Started DELETE "/v1/members/3" for 127.0.0.1 at 2018-08-22 20:20:39 -0500
Processing by API::V1::MembersController#destroy as */*
Parameters: {"member"=>{"id"=>3}, "id"=>"3"}
�[1m�[36mMember Load (1.0ms)�[0m �[1m�[34mSELECT "members".* FROM "members" WHERE "members"."uid" = $1 LIMIT $2�[0m [["uid", "lassitergregg@gmail.com"], ["LIMIT", 1]]
↳ /Users/lassitergregg/.rvm/gems/ruby-2.5.0/gems/activerecord-5.2.1/lib/active_record/log_subscriber.rb:97
�[1m�[36mMember Load (0.7ms)�[0m �[1m�[34mSELECT "members".* FROM "members" WHERE "members"."id" = $1 LIMIT $2�[0m [["id", 3], ["LIMIT", 1]]
↳ app/controllers/api/v1/members_controller.rb:57
�[1m�[35m (0.2ms)�[0m �[1m�[35mBEGIN�[0m
↳ app/controllers/api/v1/members_controller.rb:59
�[1m�[36mFamilyMember Load (0.4ms)�[0m �[1m�[34mSELECT "family_members".* FROM "family_members" WHERE "family_members"."member_id" = $1�[0m [["member_id", 3]]
↳ app/controllers/api/v1/members_controller.rb:59
�[1m�[36mFamilyMember Destroy (0.5ms)�[0m �[1m�[31mDELETE FROM "family_members" WHERE "family_members"."id" = $1�[0m [["id", 3]]
↳ app/controllers/api/v1/members_controller.rb:59
�[1m�[36mActiveStorage::Attachment Load (1.2ms)�[0m �[1m�[34mSELECT "active_storage_attachments".* FROM "active_storage_attachments" WHERE "active_storage_attachments"."record_id" = $1 AND "active_storage_attachments"."record_type" = $2 AND "active_storage_attachments"."name" = $3 LIMIT $4�[0m [["record_id", 3], ["record_type", "Member"], ["name", "avatar"], ["LIMIT", 1]]
↳ app/controllers/api/v1/members_controller.rb:59
�[1m�[36mMember Destroy (0.4ms)�[0m �[1m�[31mDELETE FROM "members" WHERE "members"."id" = $1�[0m [["id", 3]]
↳ app/controllers/api/v1/members_controller.rb:59
�[1m�[35m (2.2ms)�[0m �[1m�[35mCOMMIT�[0m
↳ app/controllers/api/v1/members_controller.rb:59
[active_model_serializers] Rendered ActiveModel::Serializer::Null with Hash (0.06ms)
�[1m�[35m (0.2ms)�[0m �[1m�[35mBEGIN�[0m
↳ /Users/lassitergregg/.rvm/gems/ruby-2.5.0/gems/activerecord-5.2.1/lib/active_record/log_subscriber.rb:97
�[1m�[36mMember Load (0.8ms)�[0m �[1m�[37mSELECT "members".* FROM "members" WHERE "members"."id" = $1 LIMIT $2 FOR UPDATE�[0m [["id", 3], ["LIMIT", 1]]
↳ /Users/lassitergregg/.rvm/gems/ruby-2.5.0/gems/activerecord-5.2.1/lib/active_record/log_subscriber.rb:97
�[1m�[35m (0.2ms)�[0m �[1m�[31mROLLBACK�[0m
↳ /Users/lassitergregg/.rvm/gems/ruby-2.5.0/gems/activerecord-5.2.1/lib/active_record/log_subscriber.rb:97
Completed 404 Not Found in 62859ms (Views: 0.7ms | ActiveRecord: 7.7ms)
Rails Stacktrace: this can be found in the log/development.log of your API.
Environmental Info: How is your application different from the reference implementation? This may include (but is not limited to) the following details:
Custom Overrides: what have you done in terms of custom controller overrides?
I've overridden part of the registration controller to create a few join model records on create.
The text was updated successfully, but these errors were encountered:
I'm expecting on delete to get a
204
but get a404
because devise_token_auth attempts to find to create headers:This stack overflow question was posted earlier before I realized that devise_token_auth was searching for member to create new headers because the current_user had not been signed out. I tried doing
sign_out current_user
which returned an empty hash but still returned the same 404 error. Am I missing something?This is my member controller:
Version: which version of this gem (and [ng-token-auth]
Latest gem version
SQL Log Right before Stacktrace:
log/development.log
of your API.Environmental Info: How is your application different from the reference implementation? This may include (but is not limited to) the following details:
I've overridden part of the registration controller to create a few join model records on create.
The text was updated successfully, but these errors were encountered: