Sha256: e23a37b55be633f5b177686752908dbf0a5e8a832d25af7122eec6dfae18dc6f
Contents?: true
Size: 609 Bytes
Versions: 38
Compression:
Stored size: 609 Bytes
Contents
class PagePartial < DynamicView before_validation :prepend_underscore validates_format_of :name, :with => /\A_[a-z]+[a-z0-9_]*\Z/, :message => "can only contain lowercase letters, numbers and underscores and must begin with an underscore" def file_path File.join(self.class.base_path, "partials", file_name) end def self.display_name(file_name) name, format, handler = file_name.split('.') "#{name.sub(/^_/,'').titleize} (#{format}/#{handler})" end def prepend_underscore if !name.blank? && name[0,1] != '_' self.name = "_#{name}" end end end
Version data entries
38 entries across 38 versions & 10 rubygems