Class: Blogaze::Models::Comment
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- Blogaze::Models::Comment
- Defined in:
- lib/blogaze/models/comment.rb
Overview
Post comments model
Instance Method Summary collapse
- #before_create ⇒ Object
-
#validate ⇒ Object
Validations.
Instance Method Details
#before_create ⇒ Object
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 |
#validate ⇒ Object
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 |