Use Rails 7.1 normalizes
feature (#27521)
This commit is contained in:
parent
50b7ea810e
commit
714e3ae5b5
5 changed files with 7 additions and 25 deletions
|
@ -19,7 +19,8 @@ class Relay < ApplicationRecord
|
|||
|
||||
scope :enabled, -> { accepted }
|
||||
|
||||
before_validation :strip_url
|
||||
normalizes :inbox_url, with: ->(inbox_url) { inbox_url.strip }
|
||||
|
||||
before_destroy :ensure_disabled
|
||||
|
||||
alias enabled? accepted?
|
||||
|
@ -76,8 +77,4 @@ class Relay < ApplicationRecord
|
|||
def ensure_disabled
|
||||
disable! if enabled?
|
||||
end
|
||||
|
||||
def strip_url
|
||||
inbox_url&.strip!
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue