Sha256: f804ad5cdbcb15dff581b3e9a0ea8a99a1c1e874a7b77128806498b40e834ea1
Contents?: true
Size: 581 Bytes
Versions: 79
Compression:
Stored size: 581 Bytes
Contents
class Snippet < ActiveRecord::Base # Default Order default_scope { order('name') } # Associations belongs_to :created_by, class_name: 'User' belongs_to :updated_by, class_name: 'User' # Validations validates_presence_of :name validates_length_of :name, maximum: 100 validates_length_of :filter_id, maximum: 25, allow_nil: true validates_format_of :name, with: %r{\A\S*\z} validates_uniqueness_of :name object_id_attr :filter, TextFilter def after_initialize self.filter_id ||= TrustyCms::Config['defaults.snippet.filter'] if new_record? end end
Version data entries
79 entries across 79 versions & 1 rubygems