Added ransack search function to admin/users index

This commit is contained in:
2024-09-18 14:59:07 +02:00
parent 4bff15cd4e
commit ff1c1017cf
11 changed files with 77 additions and 21 deletions

View File

@@ -42,4 +42,16 @@ class User < ApplicationRecord
def name
[ firstname, " ", lastname ].join
end
def self.ransackable_attributes(auth_object = nil)
[ "created_at", "email", "firstname", "id", "jobs_as_costumer_count", "jobs_as_operator_count", "lastname", "role", "verified", "name" ]
end
def self.ransackable_associations(auth_object = nil)
[]
end
ransacker :name do
Arel.sql("CONCAT_WS(' ', users.firstname, users.lastname)")
end
end