Class: Newsly::Template
- Inherits:
-
LiquidModel
- Object
- ActiveRecord::Base
- LiquidModel
- Newsly::Template
- Defined in:
- app/models/newsly/template.rb
Instance Method Summary collapse
- #body_must_follow_validation_rules ⇒ Object
-
#publish ⇒ Object
Takes a draft and copies information to the original.
Methods inherited from LiquidModel
#after_validation, #body=, #render
Instance Method Details
#body_must_follow_validation_rules ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'app/models/newsly/template.rb', line 26 def body_must_follow_validation_rules failed = [] unless validation_rules.blank? validation_rules.split(',').each do |rule| rule = rule.strip failed.push(rule) unless body=~ /{{rule}}/ end errors.add(:body, "#{failed.to_sentence} is required") if failed.length > 0 end end |