Files
grecia/app/controllers/admin/organizations_controller.rb
Javi Martín 155da08cf0 Use a generic name for the search parameter
This way we can use it for any model.
2020-12-04 19:57:05 +01:00

30 lines
897 B
Ruby

class Admin::OrganizationsController < Admin::BaseController
has_filters %w[pending all verified rejected], only: :index
load_and_authorize_resource except: :search
def index
@organizations = @organizations.send(@current_filter)
@organizations = @organizations.includes(:user)
.order("users.created_at", :name, "users.email")
.page(params[:page])
end
def search
@organizations = Organization.includes(:user)
.search(params[:search])
.order("users.created_at", :name, "users.email")
.page(params[:page])
end
def verify
@organization.verify
redirect_with_query_params_to(action: :index)
end
def reject
@organization.reject
redirect_with_query_params_to(action: :index)
end
end