Skip to content

Commit

Permalink
fix admin crash
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienpoly committed Jan 29, 2024
1 parent 25ce7c5 commit 8e82bed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/avo/resources/user.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Avo::Resources::User < Avo::BaseResource
self.title = :admin_title
self.title = :name_for_admin
self.includes = []
self.search = {
query: -> { query.ransack(email_cont: params[:q], id_eq: params[:q], m: "or").result(distinct: true) }
Expand Down
4 changes: 4 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ class User < ApplicationRecord
after_update if: :password_digest_previously_changed? do
sessions.where.not(id: Current.session).delete_all
end

def name_for_admin
[first_name, last_name, "(#{email})"].join(" ")
end
end

0 comments on commit 8e82bed

Please sign in to comment.