Skip to content

Commit 881e955

Browse files
committed
Update README [ci skip]
1 parent 30095db commit 881e955

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ AjaxDatatablesRails.configure do |config|
9595
# available options for db_adapter are: :pg, :mysql, :mysql2, :sqlite, :sqlite3
9696
# config.db_adapter = :pg
9797

98+
# Or you can use your rails environment adapter if you want a generic dev and production
99+
# config.db_adapter = Rails.configuration.database_configuration[Rails.env]['adapter'].to_sym
100+
98101
# available options for orm are: :active_record, :mongoid
99102
# config.orm = :active_record
100103
end
@@ -601,6 +604,21 @@ def get_raw_records
601604
end
602605
```
603606

607+
### Default scope
608+
609+
See [DefaultScope is evil](https://rails-bestpractices.com/posts/2013/06/15/default_scope-is-evil/) and [#223](https://github.com/jbox-web/ajax-datatables-rails/issues/223) and [#233](https://github.com/jbox-web/ajax-datatables-rails/issues/233).
610+
611+
### DateRange search
612+
613+
This feature works with [yadcf](https://github.com/vedmack/yadcf).
614+
615+
To enable the date range search, for example `created_at` :
616+
617+
* add a 'created_at' `<th>` in your html
618+
* declare your column in `view_columns` : `created_at: { source: 'Post.created_at', cond: :date_range, delimiter: '-yadcf_delim-' }`
619+
* add it in `data` : `created_at: record.decorate.created_at`
620+
* setup yadcf to make `created_at` search field a range
621+
604622
### Generator Syntax
605623

606624
Also, a class that inherits from `AjaxDatatablesRails::Base` is not tied to an

0 commit comments

Comments
 (0)