heylium_app/app/models/comment.rb
Nicolas Bally 8e18de4077 initial
2016-08-03 00:22:29 +02:00

18 lines
420 B
Ruby
Executable File

# -*- encoding : utf-8 -*-
class Comment < ActiveRecord::Base
include ActsAsCommentable::Comment
belongs_to :commentable, :polymorphic => true
validates :pseudo, :presence => true
validates :email, :presence => true, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
validates :comment, :presence => true
scope :recents, -> {where("enabled = ?",true ).order("created_at ASC")}
acts_as_tree
end