Sha256: 497a445df8a710b7934dd7e571a7d76ee5692bdb06e9ed9262a303f72078ce9c
Contents?: true
Size: 445 Bytes
Versions: 1
Compression:
Stored size: 445 Bytes
Contents
class Comment < ActiveRecord::Base belongs_to :commentable, :polymorphic => true, :counter_cache => true belongs_to :user validates_presence_of :body validates_presence_of :user, :commentable before_save :generate_formatted_body private def generate_formatted_body formatter = commentable.class.commentable_options[:format] write_attribute :formatted_body, formatter.call(self) if formatter.respond_to?(:call) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
commentable-0.1.0 | lib/commentable/comment.rb |