ruby on rails - customizing csv format in activeadmin disables csv download link -


i have rails app mildly customized activeadmin table of registered users. app/admin/users.rb looks this:

activeadmin.register user   actions :index, :show    preserve_default_filters!   filter :referrer, collection: user.all.map{ |user| [user.email, user.id] }   filter :referrals, collection: user.all.map{ |user| [user.email, user.id] }    index      column :id     column("name")              { |user| user.first_name + " " + user.last_name }     column :email     column("referrer", :referrer, :sortable => :referrer_id)     column :referral_code     column("created at", :created_at, :sortable => :created_at)     column("referral count")    { |user| user.referrals.count }     actions   end end 

this works expected. want customize layout of csv file download. add block right before last end:

  csv      column :id     column("name")        { |user| user.first_name + " " + user.last_name }     column :email     column("referrer", :referrer)     column :referral_code     column("created at", :created_at)     column("referral count")  { |user| user.referrals.count }   end 

after adding this, clicking csv link doesn't in browser. i'm running app locally foreman , shows following errors after click on link:

08:58:12 web.1    | e, [2014-09-10t08:58:12.818820 #4610] error -- : app error: no implicit conversion of symbol hash (typeerror) 08:58:12 web.1    | e, [2014-09-10t08:58:12.818937 #4610] error -- : /users/maxnorton/.bundler/ruby/2.0.0/active_admin-bf9dabe6a568/lib/active_admin/csv_builder.rb:41:in `merge' 08:58:12 web.1    | e, [2014-09-10t08:58:12.818999 #4610] error -- : /users/maxnorton/.bundler/ruby/2.0.0/active_admin-bf9dabe6a568/lib/active_admin/csv_builder.rb:41:in `column' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819059 #4610] error -- : /users/maxnorton/documents/dev/prelaunchr/app/admin/users.rb:23:in `block (2 levels) in <top (required)>' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819116 #4610] error -- : /users/maxnorton/.bundler/ruby/2.0.0/active_admin-bf9dabe6a568/lib/active_admin/csv_builder.rb:59:in `instance_exec' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819176 #4610] error -- : /users/maxnorton/.bundler/ruby/2.0.0/active_admin-bf9dabe6a568/lib/active_admin/csv_builder.rb:59:in `exec_columns' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819233 #4610] error -- : /users/maxnorton/.bundler/ruby/2.0.0/active_admin-bf9dabe6a568/lib/active_admin/csv_builder.rb:46:in `build' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819289 #4610] error -- : /library/ruby/gems/2.0.0/gems/actionpack-4.1.4/lib/action_dispatch/http/response.rb:95:in `each' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819363 #4610] error -- : /library/ruby/gems/2.0.0/gems/actionpack-4.1.4/lib/action_dispatch/http/response.rb:95:in `each' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819421 #4610] error -- : /library/ruby/gems/2.0.0/gems/actionpack-4.1.4/lib/action_dispatch/http/response.rb:95:in `each' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819477 #4610] error -- : /library/ruby/gems/2.0.0/gems/actionpack-4.1.4/lib/action_dispatch/http/response.rb:50:in `each' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819534 #4610] error -- : /library/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/body_proxy.rb:31:in `each' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819591 #4610] error -- : /library/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/body_proxy.rb:31:in `each' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819654 #4610] error -- : /library/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/body_proxy.rb:31:in `each' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819712 #4610] error -- : /library/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/body_proxy.rb:31:in `each' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819767 #4610] error -- : /library/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/body_proxy.rb:31:in `each' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819822 #4610] error -- : /library/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/body_proxy.rb:31:in `each' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819876 #4610] error -- : /library/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/body_proxy.rb:31:in `each' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819931 #4610] error -- : /library/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/lint.rb:647:in `each' 08:58:12 web.1    | e, [2014-09-10t08:58:12.819987 #4610] error -- : /library/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/body_proxy.rb:31:in `each' 08:58:12 web.1    | e, [2014-09-10t08:58:12.820042 #4610] error -- : /library/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/chunked.rb:23:in `each' 08:58:12 web.1    | e, [2014-09-10t08:58:12.820100 #4610] error -- : /library/ruby/gems/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_response.rb:60:in `http_response_write' 08:58:12 web.1    | e, [2014-09-10t08:58:12.820193 #4610] error -- : /library/ruby/gems/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:586:in `process_client' 08:58:12 web.1    | e, [2014-09-10t08:58:12.820252 #4610] error -- : /library/ruby/gems/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:670:in `worker_loop' 08:58:12 web.1    | e, [2014-09-10t08:58:12.820307 #4610] error -- : /library/ruby/gems/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:525:in `spawn_missing_workers' 08:58:12 web.1    | e, [2014-09-10t08:58:12.820362 #4610] error -- : /library/ruby/gems/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:140:in `start' 08:58:12 web.1    | e, [2014-09-10t08:58:12.820417 #4610] error -- : /library/ruby/gems/2.0.0/gems/unicorn-4.8.3/bin/unicorn:126:in `<top (required)>' 08:58:12 web.1    | e, [2014-09-10t08:58:12.820471 #4610] error -- : /usr/bin/unicorn:23:in `load' 08:58:12 web.1    | e, [2014-09-10t08:58:12.820525 #4610] error -- : /usr/bin/unicorn:23:in `<main>' 

seems first error line might key, i'm not sure symbol it's referring to. doing wrong?

try this:

... column("referrer")  { |user| user.referrer } column :referral_code column("created at")  { |user| user.created_at } ... 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -