Class: CmsTemplate
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- CmsTemplate
- Defined in:
- app/models/cms_template.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'app/models/cms_template.rb', line 5 def @options end |
Instance Method Details
#after_find ⇒ Object
9 10 11 12 |
# File 'app/models/cms_template.rb', line 9 def after_find require 'yaml' @options = YAML.load(self.) if self. end |
#before_save ⇒ Object
24 25 26 27 |
# File 'app/models/cms_template.rb', line 24 def before_save require 'yaml' self. = YAML.dump(@options) end |
#content=(value) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/models/cms_template.rb', line 14 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 |