Sha256: cdf3d721d2ea79df70da5e66e08c83e0cdd390b4da4ebb610efe54ba18e287f7

Contents?: true

Size: 661 Bytes

Versions: 25

Compression:

Stored size: 661 Bytes

Contents

# HasOneEmailReview
# Allows any model to easily review an email template and make changes to the body

module HasOneEmailReview
  extend ActiveSupport::Concern

  module Base
    def has_one_email_review
      include ::HasOneEmailReview
    end
  end

  included do
    attr_accessor :email_review

    validate(if: -> { email_review.present? }) do
      self.errors.add(:base, 'reviewed email is invalid') unless email_review.valid?
    end
  end

  def build_email_review(atts = {})
    self.email_review ||= Effective::EmailReview.build(atts)
  end

  def email_review_attributes=(atts)
    self.email_review = Effective::EmailReview.new(atts)
  end

end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
effective_email_templates-1.9.0 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.8.0 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.7.0 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.6.0 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.5.1 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.5.0 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.4.1 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.4.0 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.3.0 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.2.3 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.2.2 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.2.1 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.2.0 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.1.4 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.1.3 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.1.2 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.1.1 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.1.0 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.0.13 app/models/concerns/has_one_email_review.rb
effective_email_templates-1.0.12 app/models/concerns/has_one_email_review.rb