Sha256: cb8db576ff3a1a396fd110a031753201a640eb7b93bbf2b6834e9c9bf942fcb1
Contents?: true
Size: 430 Bytes
Versions: 20
Compression:
Stored size: 430 Bytes
Contents
# An ActiveRecord validator for any liquid field that you would use with effective_email_templates or otherwise # # validates :body, liquid: true class LiquidValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) if value.present? begin Liquid::Template.parse(value) rescue Liquid::SyntaxError => e record.errors.add(attribute, e.message) end end end end
Version data entries
20 entries across 20 versions & 1 rubygems