Created
October 11, 2012 03:00
-
-
Save vijedi/3869916 to your computer and use it in GitHub Desktop.
Active Admin Handling Sort Param
This file contains 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
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