Sha256: 522593170f43574575965e5f384c21b76a85e5822bca79efc43cfcd48304907c
Contents?: true
Size: 615 Bytes
Versions: 1
Compression:
Stored size: 615 Bytes
Contents
class Comment < Item attr_accessor :item_id validates_presence_of :item_id def item= item self.item_id = item._id _cache[:item] = item end def item _cache[:item] ||= Item.by_id item_id end after_create do |m| Item.update({_id: m.item_id}, {_inc: {comments_count: 1}}) end after_destroy do |m| Item.update({_id: m.item_id}, {_inc: {comments_count: -1}}) end available_as_markup :text assign :original_text, String, true validates_presence_of :text before_save{|m| m.dependent!} # TODO3 search # searchable do # text :text, using: :text_as_text # end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rad_kit-0.0.10 | app/models/comment.rb |