snippet_file.rb.tmpl (397B)
1 class SnippetFile < ApplicationRecord 2 belongs_to :snippet 3 4 counter_culture :snippet 5 6 validates :title, presence: true, length: { maximum: 40 } 7 validates :content, presence: true, length: { maximum: 200000 } 8 validates :language, presence: true, inclusion: { in: Editor.languages.keys.map(&:to_s) } 9 validates :tabs, numericality: { only_integer: true }, inclusion: { in: [2, 4, 8] } 10 end