tute/merit — pull request #38 by mrubi (2012-12-03 21:09:33+00:00)
Title: bug fix

There was a subtle bug when 2 rules were triggered by the same controller#action but had different targets for their badges. For instance:

grant_on 'comments#create', :badge => 'top-commenter', :to => :user do |comment|
comment.user.comments_count > 5
end

grant_on 'comments#create', :badge => 'popular-post', :to => :post_owner do |comment|
comment.post.comments_count > 20
end

The bug was caused by lazy initializing the @target object of an action, because the same action instance was shared across different rules