data(safe_mailer): ajout d'un object permetant d'orienter les mails vers un unique fournisseur au cas ou l'autre soit down
This commit is contained in:
parent
733ba01695
commit
2f43ffc940
3 changed files with 28 additions and 1 deletions
18
app/models/safe_mailer.rb
Normal file
18
app/models/safe_mailer.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: safe_mailers
|
||||||
|
#
|
||||||
|
# id :bigint not null, primary key
|
||||||
|
# forced_delivery_method :string
|
||||||
|
# created_at :datetime not null
|
||||||
|
# updated_at :datetime not null
|
||||||
|
#
|
||||||
|
class SafeMailer < ApplicationRecord
|
||||||
|
before_create do
|
||||||
|
raise if SafeMailer.count == 1
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.forced_delivery_method
|
||||||
|
first&.forced_delivery_method
|
||||||
|
end
|
||||||
|
end
|
9
db/migrate/20230110153638_create_safe_mailers.rb
Normal file
9
db/migrate/20230110153638_create_safe_mailers.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
class CreateSafeMailers < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
create_table :safe_mailers do |t|
|
||||||
|
t.string :forced_delivery_method
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2023_01_11_094621) do
|
ActiveRecord::Schema.define(version: 2023_01_10_181426) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pgcrypto"
|
enable_extension "pgcrypto"
|
||||||
|
|
Loading…
Reference in a new issue