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
|
@ -23,10 +23,7 @@ class AccountAlias < ApplicationRecord
|
|||
after_create :add_to_account
|
||||
after_destroy :remove_from_account
|
||||
|
||||
def acct=(val)
|
||||
val = val.to_s.strip
|
||||
super(val.start_with?('@') ? val[1..] : val)
|
||||
end
|
||||
normalizes :acct, with: ->(acct) { acct.strip.delete_prefix('@') }
|
||||
|
||||
def pretty_acct
|
||||
username, domain = acct.split('@', 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue