diff --git a/app/models/user.rb b/app/models/user.rb index 19c3bd790a7470b740187ac150ce4bf607b22dfa..6ab66091be996263f2dad35fc5a0b96d198205c6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -53,6 +53,8 @@ # fk_rails_... (university_id => universities.id) # class User < ApplicationRecord + # In this order, "resize avatar" callback will be fired after the others. + include WithAvatar include WithAuthentication include WithRoles include WithSyncBetweenUniversities @@ -60,11 +62,9 @@ class User < ApplicationRecord belongs_to :university belongs_to :language has_one :researcher, class_name: 'Research::Researcher' - has_one_attached_deletable :picture scope :ordered, -> { order(:last_name, :first_name) } - def to_s "#{first_name} #{last_name}" end diff --git a/app/models/user/with_avatar.rb b/app/models/user/with_avatar.rb new file mode 100644 index 0000000000000000000000000000000000000000..b06f566c44bc93a834623fe280aa59b99223f900 --- /dev/null +++ b/app/models/user/with_avatar.rb @@ -0,0 +1,7 @@ +module User::WithAvatar + extend ActiveSupport::Concern + + included do + has_one_attached_deletable :picture + end +end