Skip to content

Instantly share code, notes, and snippets.

@vijedi
Created October 11, 2012 03:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vijedi/3869916 to your computer and use it in GitHub Desktop.
Save vijedi/3869916 to your computer and use it in GitHub Desktop.
Active Admin Handling Sort Param
order = case(params[:order])
when 'user_email_desc'
'email DESC'
when 'user_email_asc'
'email ASC'
else
nil
end
if(order.nil?)
users = User.all
else
users = User.order(order)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment