Sha256: 8c1882717886cb79d4d7e232c0b3a07292cdde9bb77760fcffd79c5a299d78bb
Contents?: true
Size: 556 Bytes
Versions: 1
Compression:
Stored size: 556 Bytes
Contents
module Landable class Template < ActiveRecord::Base include Landable::TableName validates_presence_of :name, :slug, :description validates_uniqueness_of :name, case_sensitive: false validates_uniqueness_of :slug, case_sensitive: false def name= val self[:name] = val self[:slug] ||= (val && val.underscore.gsub(/[^\w_]/, '_').gsub(/_{2,}/, '_')) end def partial? file.present? end class << self def create_from_partials! Partial.all.map(&:to_template) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
landable-1.7.0 | app/models/landable/template.rb |