File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 438
438
If you want to keep things tidy in the data mapping method, you could use
439
439
[ Draper] ( https://github.com/drapergem/draper ) to define column mappings like below.
440
440
441
+ ** Note :** This is the recommanded way as you don't need to inject the ` view_context ` in the Datatable object to access helpers methods.
442
+ It also helps in separating view/presentation logic from filtering logic (the only one that really matters in a datatable class).
443
+
441
444
Example :
442
445
443
446
``` ruby
@@ -483,8 +486,6 @@ class UserDecorator < ApplicationDecorator
483
486
end
484
487
```
485
488
486
- This way you don't need to inject the ` view_context ` in the Datatable object to access helpers methods.
487
-
488
489
### Pass options to the datatable class
489
490
490
491
An ` AjaxDatatablesRails::ActiveRecord ` inherited class can accept an options hash at initialization. This provides room for flexibility when required.
You can’t perform that action at this time.
0 commit comments