lib/voteable_mongoid/voteable/votes.rb in voteable_mongoid-0.6.0 vs lib/voteable_mongoid/voteable/votes.rb in voteable_mongoid-0.6.1
- old
+ new
@@ -8,14 +8,21 @@
VOTES_POINT = 'votes.p'
class Votes
include Mongoid::Document
- field :u, :type => Array
- field :d, :type => Array
+ field :u, :type => Array, :default => []
+ field :d, :type => Array, :default => []
field :uc, :type => Integer, :default => 0
field :dc, :type => Integer, :default => 0
field :c, :type => Integer, :default => 0
field :p, :type => Integer, :default => 0
+
+ def identity
+ # To remove _id
+ end
end
+
+ VOTES_DEFAULT_ATTRIBUTES = Votes.new.attributes
+ VOTES_DEFAULT_ATTRIBUTES.delete('_id')
end
end