Last active
August 3, 2017 15:56
-
-
Save samflores/023640e518ee16fa47dce2fc564b06cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/admin/picture.rb | |
ActiveAdmin.register Picture, namespace: :sales do | |
config.filters = false | |
config.clear_action_items! | |
config.clear_batch_actions! | |
actions :index, :show, :edit, :update | |
sidebar I18n.t('active_admin.sidebars.search'), only: :index do | |
# define sidebar here | |
end | |
index as: :grid, columns: 4 do |picture| | |
# define index here | |
end | |
show do | |
# define show here | |
end | |
controller do | |
def scoped_collection | |
collection = end_of_association_chain | |
collection = collection.for_projects_containing(params[:s]) unless params[:s].blank? | |
collection.recent.ranked # <== apply your sorting here | |
end | |
def apply_sorting(chain) | |
chain # <== return the relation without ActiveAdmin's default sorting | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment