Sha256: 37f8e5943d21f0d8fe21239655226f02e956e22468b1c1a3425952c52fde996f
Contents?: true
Size: 728 Bytes
Versions: 12
Compression:
Stored size: 728 Bytes
Contents
class CmsTemplate < ActiveRecord::Base acts_as_versioned attr_accessor :options has_many :pages, class_name: 'CmsPage' after_find :deserialize_yaml before_save :serialize_yaml def content=(value) if value && value.is_a?(String) # filter suspicious content... go overboard for now, fine-tune later perhaps value.gsub!(/<(%.*?(exec|system)\s?\(.*?\s*%)>/, '<\1>') value.gsub!(/<(%.*?\%x\s?\[.*?\s*%)>/, '<\1>') value.gsub!(/<(%.*?`.*?\s*%)>/, '<\1>') end super(value) end def deserialize_yaml @options = YAML.load(self.options_yaml) if self.options_yaml end def serialize_yaml self.options_yaml = YAML.dump(@options) end end
Version data entries
12 entries across 12 versions & 1 rubygems