Class: Blogaze::Models::Comment

Inherits:
Sequel::Model
  • Object
show all
Defined in:
lib/blogaze/models/comment.rb

Overview

Post comments model

Instance Method Summary collapse

Instance Method Details

#before_createObject



27
28
29
30
31
# File 'lib/blogaze/models/comment.rb', line 27

def before_create
  super
  self.created_at = Time.now.to_i
  self.updated_at = 0
end

#validateObject

Validations



22
23
24
25
# File 'lib/blogaze/models/comment.rb', line 22

def validate
  validates_presence [:post_id, :author, :body]
  validates_integer :post_id
end