Chore: Switch from Carrierwave to ActiveStorage (#393)

This commit is contained in:
Sojan Jose
2020-01-07 22:59:17 +05:30
committed by Pranav Raj S
parent f02d422b6a
commit f875a09fb7
29 changed files with 192 additions and 164 deletions

View File

@@ -47,6 +47,7 @@ class User < ApplicationRecord
include DeviseTokenAuth::Concerns::User
include Events::Types
include Pubsubable
include Avatarable
include Rails.application.routes.url_helpers
devise :database_authenticatable,
@@ -57,12 +58,6 @@ class User < ApplicationRecord
:validatable,
:confirmable
# Used by the actionCable/PubSub Service we use for real time communications
has_secure_token :pubsub_token
# Uses active storage for the avatar
has_one_attached :avatar
# The validation below has been commented out as it does not
# work because :validatable in devise overrides this.
# validates_uniqueness_of :email, scope: :account_id
@@ -108,14 +103,6 @@ class User < ApplicationRecord
Rails.configuration.dispatcher.dispatch(AGENT_REMOVED, Time.zone.now, account: account)
end
def avatar_url
if avatar.attached? && avatar.representable?
url_for(avatar.representation(resize: '250x250'))
else
''
end
end
def push_event_data
{
name: name,