undefined method `_sash' for true:TrueClass

214 Views Asked by At

I using gem 'merit' to give points to users when they create a comment. I also want to remove the points for create (5) when I delete the comment. I(admin) can delete comments. When I click to delete, I get an error in the title and points are not removed.

score 5, :on => ['comments#create'], category: 'gold_points'

score -5, :on => ['comments#destroy'], to: :user, category: 'gold_points'

I also see this in log

[merit] NoMethodError on `NilClass#user` (called from Merit::TargetFinder#other_target) 
1

There are 1 best solutions below

0
On

It's because on destroy, the comment doesn't exist anymore to call user on it and grant reputation.

See related issue: https://github.com/tute/merit/issues/171#issuecomment-44185696.