List to CSV or Excel with ActiveScaffold and Rails 6

57 views
Skip to first unread message

Dennis Bulgatz

unread,
Aug 6, 2020, 4:25:36 AM8/6/20
to ActiveScaffold : Ruby on Rails Gem

Hello.. Would like to export the list view to CSV or Excel.


When I start the rails server

/Users/dbulgatz/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/active_scaffold_export-3.3.2/lib/active_scaffold_export/config/core.rb:18:in `block in <top (required)>': uninitialized constant ActionDispatch::Routing::ACTIVE_SCAFFOLD_CORE_ROUTING (NameError)

Routing issue?  What should a route look for a controller using active_scaffold_export?

Thanks!

Sergio Cambra

unread,
Aug 6, 2020, 4:36:37 AM8/6/20
to actives...@googlegroups.com
That gem is not updated to latest active scaffold version, try with this fork:

I think it works with newest activescaffold, but nobody confirmed yet. Also i'm waiting to get permission to release new version in rubygems.

Best regards


--
You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email to activescaffol...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/activescaffold/8b56bb3a-c800-4e3c-b709-f4fb5ed33b46n%40googlegroups.com.

Dennis Bulgatz

unread,
Aug 6, 2020, 11:24:13 AM8/6/20
to ActiveScaffold : Ruby on Rails Gem
Thanks Sergio!

Changed gem to use the master branch, and no more errors when starting the server, but no export option appears in the view with config.actions.add :export.  I can use config.action_links.add :index, label: 'Export' but not sure what params to pass for it to work.  Do I need to add a method to the controller? 

active_scaffold do |config|
    #config.action_links.add :index, label: 'Export'
    config.actions.add :export
    config.export.default_file_format = 'csv' # or 'xlsx'

Sergio Cambra

unread,
Aug 11, 2020, 9:53:38 AM8/11/20
to ActiveScaffold : Ruby on Rails Gem, Dennis Bulgatz

Hi


I was out and couldn't test it before.


I have checked with both rails 5.2 and rails 6.0 and I get export link, next to seach, just with config.actions.add :export line.


What rails version do you use? And active_scaffold version? You may try master branch of active_scaffold, although I would expect master of export plugin would work with ActiveScaffold 3.5.x


Regards

Dennis Bulgatz

unread,
Aug 11, 2020, 10:49:43 AM8/11/20
to ActiveScaffold : Ruby on Rails Gem
The issue was I forgot to add export to the actions config line.  Doh!  Thanks again.

FWIW, I did try master AS Branch, but of course it did not help.  Commenting out other controller config options was the key to finding the problem.

    config.export.default_file_format = 'csv' # or 'xlsx' 
    config.list.columns = [:id, :tdn_number, :rev, :is_latest, :title, :clin, :discipline, :sub_tdns, :rev_siblings ]
    config.list.sorting = [{ :tdn_number => :asc}, {:rev => :asc}]
    config.actions = [:nested, :create, :list, :show, :field_search, :delete, :export]
Reply all
Reply to author
Forward
0 new messages