Class: Users::LogServices
- Inherits:
-
Lesli::ApplicationLesliService
- Object
- Lesli::ApplicationLesliService
- Users::LogServices
- Defined in:
- app/services/lesli_audit/users/log_services.rb
Instance Method Summary collapse
-
#index ⇒ Hash
Paginated list of the records.
Instance Method Details
#index ⇒ Hash
Returns Paginated list of the records.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/services/lesli_audit/users/log_services.rb', line 41 def index search_string = query[:search].downcase.gsub(" ","%") unless query[:search].blank? records = current_user.account.users.joins(:logs) #records = records.where("users.email = ?", query[:filters][:user]) unless query[:filters][:user].blank? records = records.where("title like :search or description like :search", { search: "%#{search_string}%"}) unless search_string.blank? records = records.select( :id, "users.id as user_id", "users.email", :title, :description, Date2.new.date_time.("user_logs") ) .page(query[:pagination][:page]) .per(query[:pagination][:perPage]) .order("user_logs.created_at DESC") records end |