Skip to content

Commit 55ce81d

Browse files
committed
Update README [ci skip]
1 parent bf23c7a commit 55ce81d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff 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

584584
If 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

0 commit comments

Comments
 (0)