Don't accept asciicasts of 0 width or 0 height

This commit is contained in:
Marcin Kulik 2015-05-18 16:06:14 +00:00
parent 66377b8d7d
commit 6530152356

View File

@ -20,8 +20,8 @@ class Asciicast < ActiveRecord::Base
validates :stdout_data, :stdout_timing, presence: true, unless: :file validates :stdout_data, :stdout_timing, presence: true, unless: :file
validates :file, presence: true, unless: :stdout_data validates :file, presence: true, unless: :stdout_data
validates :snapshot_at, numericality: { greater_than: 0, allow_blank: true } validates :snapshot_at, numericality: { greater_than: 0, allow_blank: true }
validates :terminal_columns, presence: true, numericality: { less_than_or_equal_to: 1000 } validates :terminal_columns, presence: true, numericality: { greater_than: 0, less_than_or_equal_to: 1000 }
validates :terminal_lines, presence: true, numericality: { less_than_or_equal_to: 500 } validates :terminal_lines, presence: true, numericality: { greater_than: 0, less_than_or_equal_to: 500 }
scope :featured, -> { where(featured: true) } scope :featured, -> { where(featured: true) }
scope :by_recency, -> { order("created_at DESC") } scope :by_recency, -> { order("created_at DESC") }