Sha256: 4e4f086ecfc7f1850df85b7f7691574941b9136f58dbd0713a36f1d64a7f37b5
Contents?: true
Size: 567 Bytes
Versions: 4
Compression:
Stored size: 567 Bytes
Contents
class Post < ActiveRecord::Base # Use friendly_id extend FriendlyId friendly_id :title, use: :slugged # Markdown before_save { MarkdownWriter.update_html(self) } # Validations validates :title, presence: true, length: { maximum: 100 }, uniqueness: true validates :content_md, presence: true # Pagination paginates_per 30 # Relations belongs_to :user # Scopes scope :published, lambda { where(draft: false) .order("updated_at DESC") } scope :drafted, lambda { where(draft: true) .order("updated_at DESC") } end
Version data entries
4 entries across 4 versions & 3 rubygems