File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -573,7 +573,7 @@ class MyCustomDatatable < AjaxDatatablesRails::Base
573573 {
574574 id: check_box_tag(' users[]' , record.id),
575575 first_name: link_to(record.fname, edit_resource_path(record)),
576- email: mail_to(record.email)
576+ email: mail_to(record.email),
577577 # other attributes
578578 }
579579 end
@@ -583,15 +583,16 @@ end
583583
584584If you want to keep things tidy in the data mapping method, you could use
585585[ Draper] ( https://github.com/drapergem/draper ) to define column mappings like below.
586+ On the long term it's much more cleaner than using ` def_delegator ` since decorators are reusable.
586587
587588``` ruby
588589...
589590 def data
590591 records.map do |record |
591592 {
592- id: record.decorate.id,
593+ id: record.decorate.id,
593594 first_name: record.decorate.first_name,
594- email: record.decorate.email
595+ email: record.decorate.email,
595596 # other attributes
596597 }
597598 end
You can’t perform that action at this time.
0 commit comments