about summary refs log tree commit diff stats
path: root/app/models/stream.rb
blob: 7faa370acb615e8a92caf7342ca6df6c3a79f072 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
class Stream < ApplicationRecord
  has_many :records, as: :recordable, inverse_of: :recordable
  has_many :updates

  validates :title, presence: true
  validates :slug, presence: true, format: /\A[-a-z0-9]+\z/

  accepts_nested_attributes_for :records, allow_destroy: true

  def path
    "/thinks/#{slug}"
  end
end