Column Helpers for Active Scaffold Exports

7 views
Skip to first unread message

Dennis Bulgatz

unread,
Aug 11, 2020, 11:48:23 AM8/11/20
to ActiveScaffold : Ruby on Rails Gem
When using the active_scaffold_export, can helper methods be used to render associations?

If so, what is the pattern to define the helper?

Do not want users to see things like:
#<TrOdc::ActiveRecord_Associations_CollectionProxy:0x00007fd6268b6f38>

Tried this, which works fine in the list view

  def sub_tdn_tr_odcs_column(record, options)
    "ODC"
  end

Thanks!

Sergio Cambra

unread,
Aug 12, 2020, 11:37:57 AM8/12/20
to ActiveScaffold : Ruby on Rails Gem, Dennis Bulgatz

Hello


Helper override for export are called <column>_export_column:

https://github.com/activescaffold/active_scaffold_export/blob/master/lib/active_scaffold/helpers/export_helpers.rb#L31


They get only record argument, you can call your _column helpers from those. Default helpers rendering association columns in export are  format_plural_association_export_column and format_singular_association_export_column and they use to_label method. Probably export gem should be updated to match format_association_column helper in latest ActiveScaffold which support column.options[:label_method] to use another method instead of to_label


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/03233d7e-89b7-4112-af16-cb1bb907592bn%40googlegroups.com.

 


Reply all
Reply to author
Forward
0 new messages