Created
October 11, 2012 02:52
-
-
Save vijedi/3869888 to your computer and use it in GitHub Desktop.
Active Admin Sorting Tables
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
content do | |
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 | |
panel 'Users' do | |
section :priority => 1 do | |
table_for users, {:sortable => true, :class => 'index_table'} do | |
column('Email', :sortable => :user_email) {|user| user.email} | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment