File: comment.rb

package info (click to toggle)
ruby-client-side-validations 3.2.6%2Bgh-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 676 kB
  • sloc: javascript: 3,019; ruby: 2,959; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 403 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Comment
  extend  ActiveModel::Naming
  extend  ActiveModel::Translation
  include ActiveModel::Validations
  include ActiveModel::Conversion

  attr_reader :id, :post_id, :title, :body
  validates :title, :body, :presence => true

  def initialize(params={})
    params.each do |attr, value|
      self.public_send("#{attr}=", value)
    end if params
  end

  def persisted?
    false
  end
end