Skip to content

Commit

Permalink
delint
Browse files Browse the repository at this point in the history
  • Loading branch information
cycomachead committed Aug 2, 2023
1 parent ef6b83f commit 99d2884
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
7 changes: 1 addition & 6 deletions app/models/email_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,15 @@ class EmailTemplate < ApplicationRecord

before_destroy :prevent_deleting_required_emails

def test_data
@@test_data ||= rand(10)
end

def accepts_custom_reason?
# search for 'reason' in a liquid template
self.body.match?(/{{\s*reason/)
end

private

def prevent_deleting_required_emails
if self.required?
errors.add('Cannot delete a required email template')
errors.add("Cannot delete a required email template")
throw :abort
end
end
Expand Down
1 change: 1 addition & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

# This file is copied to spec/ when you run 'rails generate rspec:install'
require "spec_helper"
ENV["RAILS_ENV"] ||= "test"

Expand Down

0 comments on commit 99d2884

Please sign in to comment.