-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On destroy, Integer returned instead of object #365
Comments
Can you paste the contents of that controller action?
…On Wednesday, November 16, 2022, Andrei Erdoss ***@***.***> wrote:
I migrated from Ruby 2.6.6 to 3.1.2 and merit gem 3.0.3 to 4.03 and now,
on destroy action, inside the block, the parameter passed in (vote) is an
integer (always the same number - 181), not a Vote object. The other
actions work as expected.
score 2, on: 'votes#destroy', to: :voteable_user do |vote| vote.direction
== 'down' && vote.voteable_type == 'Question' end
—
Reply to this email directly, view it on GitHub
<#365>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAANH5FMSDOR6D65J2YBKOTWITVSTANCNFSM6AAAAAASCJMGQA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
def destroy
authorize! vote_action(vote_params[:direction]), @voteable
@vote = Vote.find_by(voteable_id: @voteable.id,
voteable_type: @voteable.class.name,
user_id: current_user.id,
direction: Vote.directions[vote_params[:direction]])
@vote.destroy
@voteable.reload
end |
Thanks! And can you post the logs for the action? Particularly I want to see what |
Here are the logs on DELETE of vote
|
There we go! I cut the relevant snippet:
I've never seen this one before, found the following (links to the CVE and a potential workraound): https://stackoverflow.com/questions/72970170/upgrading-to-rails-6-1-6-1-causes-psychdisallowedclass-tried-to-load-unspecif Can you retry adding |
That would be one workaround, but the solution I think would be to refactor out the |
I made the change as requested and then ran a test:
|
Two questions:
|
|
Can't reference models yet in |
Just skipped three related unit tests related to this bug: 08e65bd#diff-a2eb130f0d1ee0b07aa5562e4ae246cdaaa12ebcb16355e301c05b30b24828c8 |
I migrated from Ruby 2.6.6 to 3.1.2 and merit gem 3.0.3 to 4.03 and now, on destroy action, inside the block, the parameter passed in (vote) is an integer (always the same number - 181), not a Vote object. The other actions work as expected.
The text was updated successfully, but these errors were encountered: