Skip to content

Commit bd9e163

Browse files
committed
Update README [ci skip]
1 parent 8e694c9 commit bd9e163

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ In the end, it's up to the developer which model(s), scope(s), relationship(s)
672672
(or else) to employ inside the datatable class to retrieve records from the
673673
database.
674674

675-
## Pro Tips
675+
## ProTips™
676676

677677
### Create a master parent class
678678

doc/migrate.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class PostDatatable < ApplicationDatatable
1212
end
1313
```
1414

15+
**Note :** This is now in the [ProTips™](https://github.com/jbox-web/ajax-datatables-rails#protips) section of the documentation.
16+
1517
2) To mitigate the second change (The `view_context` is no longer injected in Datatables)
1618

1719
Update the `ApplicationDatatable` class :
@@ -30,9 +32,20 @@ end
3032
and update your controllers :
3133

3234
```ruby
35+
# before
36+
respond_to do |format|
37+
format.json { render json: UserDatatable.new(view_context) }
38+
end
39+
40+
# after
3341
respond_to do |format|
3442
format.json { render json: UserDatatable.new(params, view_context: view_context) }
3543
end
44+
45+
# if you need to inject some options
46+
respond_to do |format|
47+
format.json { render json: UserDatatable.new(params, view_context: view_context, my: 'options') }
48+
end
3649
```
3750

3851
This way, you can still use `def_delegators` in your datatables [as in the documentation](https://github.com/jbox-web/ajax-datatables-rails#using-view-helpers).

0 commit comments

Comments
 (0)