Por ejemplo, aca customize un poco la parte de reportes:
Código:
ActiveAdmin.register Report do
config.sort_order = 'position_asc'
config.paginate = false
index do
column :id
column :name
column :category do |report|
report.report_category.full_name if report.report_category.present?
end
column :sample
column :file
default_actions
end
form :html => { :enctype => "multipart/form-data" } do |f|
f.inputs "Details" do
f.input :report_type, :as => :radio, :collection => [['CSV', 'csv'], ['Download', 'download']]
f.input :name
f.input :sample
f.input :report_category
f.input :file, :as => :file
f.input :html_text
end
if f.object.file? && f.object.report_type == 'csv'
f.inputs "Sorting" do
f.input :sort_field, :as => :select, :collection => CSV.parse(open(f.object.file.url)).first
f.input :sort_order, :as => :select, :collection => [['Ascending', 'asc'], ['Descending', 'desc']]
end
end
f.buttons
end
collection_action :sort, :method => :post do
params[:report].each_with_index do |id, index|
Report.update_all(['position=?', index+1], ['id=?', id])
end
render :nothing => true
end
end
Y aca tenes un buen tutorial:
http://net.tutsplus.com/tutorials/ruby/ ... ive-admin/