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
573
573
{
574
574
id: check_box_tag(' users[]' , record.id),
575
575
first_name: link_to(record.fname, edit_resource_path(record)),
576
- email: mail_to(record.email)
576
+ email: mail_to(record.email),
577
577
# other attributes
578
578
}
579
579
end
@@ -583,15 +583,16 @@ end
583
583
584
584
If you want to keep things tidy in the data mapping method, you could use
585
585
[ 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.
586
587
587
588
``` ruby
588
589
...
589
590
def data
590
591
records.map do |record |
591
592
{
592
- id: record.decorate.id,
593
+ id: record.decorate.id,
593
594
first_name: record.decorate.first_name,
594
- email: record.decorate.email
595
+ email: record.decorate.email,
595
596
# other attributes
596
597
}
597
598
end
You can’t perform that action at this time.
0 commit comments