File: topic.rb

package info (click to toggle)
ruby-invisible-captcha 2.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 384 kB
  • sloc: ruby: 717; makefile: 6
file content (20 lines) | stat: -rw-r--r-- 409 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
20
class Topic
  include ActiveModel::Validations
  include ActiveModel::Conversion

  attr_accessor :title, :author, :body, :subtitle

  validates :title, length: { minimum: 5 }
  validates :author, presence: true
  validates :body, length: { minimum: 10 }

  def initialize(attributes = {})
    attributes.each do |name, value|
      send("#{name}=", value)
    end
  end

  def persisted?
    false
  end
end