lib/voteable_mongoid/voteable/tasks.rb in voteable_mongoid-0.7.4 vs lib/voteable_mongoid/voteable/tasks.rb in voteable_mongoid-0.7.5

- old
+ new

@@ -40,14 +40,14 @@ # votes storage but it's not human friendly # Version >= 0.7.0 use readable field names (up, down, up_count, down_count, # count, point) votes = doc['votes'] || doc['voteable'] || {} - up_voter_ids = votes['u'] || votes['up'] || + up_voter_ids = votes['up'] || votes['u'] || votes['up_voter_ids'] || doc['up_voter_ids'] || [] - down_voter_ids = votes['d'] || votes['down'] || + down_voter_ids = votes['down'] || votes['d'] || votes['down_voter_ids'] || doc['down_voter_ids'] || [] up_count = up_voter_ids.size down_count = down_voter_ids.size @@ -65,10 +65,16 @@ '$unset' => { 'up_voter_ids' => true, 'down_voter_ids' => true, 'votes_count' => true, 'votes_point' => true, - 'voteable' => true + 'voteable' => true, + 'votes.u' => true, + 'votes.d' => true, + 'votes.uc' => true, + 'votes.dc' => true, + 'votes.c' => true, + 'votes.p' => true } }, { :safe => true }) end end \ No newline at end of file