Extract attachable concerns
This commit is contained in:
+1
-6
@@ -1,5 +1,5 @@
|
||||
class Tag < ApplicationRecord
|
||||
include ActionText::Attachable, Filterable
|
||||
include Attachable, Filterable
|
||||
|
||||
has_many :taggings, dependent: :destroy
|
||||
has_many :cards, through: :taggings
|
||||
@@ -13,9 +13,4 @@ class Tag < ApplicationRecord
|
||||
def hashtag
|
||||
"#" + title
|
||||
end
|
||||
|
||||
# TODO: Move to attachable along with the concern
|
||||
def attachable_plain_text_representation(...)
|
||||
"##{title}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
module Tag::Attachable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
include ActionText::Attachable
|
||||
end
|
||||
|
||||
def attachable_plain_text_representation(...)
|
||||
"##{title}"
|
||||
end
|
||||
end
|
||||
+1
-6
@@ -1,5 +1,5 @@
|
||||
class User < ApplicationRecord
|
||||
include Accessor, ActionText::Attachable, Assignee, Mentionable, Named, Role, Searcher,
|
||||
include Accessor, Attachable, Assignee, Mentionable, Named, Role, Searcher,
|
||||
SignalUser, Transferable
|
||||
include Timelined # Depends on Accessor
|
||||
|
||||
@@ -26,11 +26,6 @@ class User < ApplicationRecord
|
||||
update! active: false, email_address: deactived_email_address
|
||||
end
|
||||
|
||||
# TODO: Move to attachable along with the concern
|
||||
def attachable_plain_text_representation(...)
|
||||
"@#{first_name.downcase}"
|
||||
end
|
||||
|
||||
private
|
||||
def deactived_email_address
|
||||
email_address.sub(/@/, "-deactivated-#{SecureRandom.uuid}@")
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
module User::Attachable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
include ActionText::Attachable
|
||||
end
|
||||
|
||||
def attachable_plain_text_representation(...)
|
||||
"@#{first_name.downcase}"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user