You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2-1
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,12 @@
1
1
# CHANGELOG
2
2
3
-
## (yet) Unreleased
3
+
## 0.2.1
4
4
* Fix count method to work with select statements under Rails 4.1. Thanks to [Jason Mitchell](https://github.com/mitchej123) for the contribution.
5
5
* Edits to `README` documentation about the `options` hash. Thanks to [Jonathan E Hogue](https://github.com/hoguej) for pointing out that previous documentation was confusing and didn't address its usage properly.
6
6
* Edits to `README` documentation on complex model queries inside the `get_raw_records` method. A round of applause to [Zoltan Paulovics](https://github.com/zpaulovics) for contributing this awesome piece of documentation. :smile:
7
7
* Adds typecast step to `search_condition` method, so now we support having non-text columns inside the `searchable_columns` array.
8
8
* Adds support for multi-column sorting and multi-term search. Thanks to [Zoltan Paulovics](https://github.com/zpaulovics) for contributing this feature.
9
+
* Adds optional config initializer, so we can have a base to typecast non text-based columns and perform searches depending on the use of `:mysql2`, `:sqlite3` or `:pg`. Thanks to [M. Saiqul Haq](https://github.com/saiqulhaq) for contributing this feature.
9
10
10
11
## 0.2.0
11
12
* This version works with jQuery dataTables ver. 1.10 and it's new API syntax.
@@ -50,7 +50,8 @@ jQuery dataTables to your Rails project. You can always add the plugin assets
50
50
manually via the assets pipeline. If you decide to use the `jquery-datatables-rails` gem, please refer to its installation instructions [here](https://github.com/rweng/jquery-datatables-rails).
51
51
52
52
## Usage
53
-
*The following examples assume that we are setting up ajax-datatables-rails for an index of users from a `User` model*
53
+
*The following examples assume that we are setting up ajax-datatables-rails for an index of users from a `User` model, and that we are using postgresql as
54
+
our db, because you __should be using it__, if not, please refer to the [Searching on non text-based columns](#searching-on-non-text-based-columns) entry in the Additional Notes section.*
54
55
55
56
### Generate
56
57
Run the following command:
@@ -92,6 +93,7 @@ the gems bundled in your project. For example, if your models are using `Kaminar
92
93
* For `searchable_columns`, assign an array of the database columns that you want searchable by datatables. For example `[users.f_name, users.l_name]`
It always comes the time when you need to add a non-string/non-text based column to the `@searchable_columns` array, so you can perform searches against these column types (example: numeric, date, time).
306
+
307
+
We recently added the ability to (automatically) typecast these column types and have this scenario covered. Please note however, if you are using something different from `postgre` (with the `:pg` gem), like `mysql` or `sqlite`, then you need to add an initializer in your application's `config/initializers` directory.
308
+
309
+
If you don't perform this step (again, if using something different from `postgre`), your database will complain that it does not understand the default typecast used to enable such searches.
310
+
311
+
You have two options to create this initializer:
312
+
313
+
* use the provided (and recommended) generator (and then just edit the file);
314
+
* create the file from scratch.
315
+
316
+
To use the generator, from the terminal execute:
317
+
318
+
```
319
+
$ bundle exec rails generate datatable:config
320
+
```
321
+
322
+
Doing so, will create the `config/initializers/ajax_datatables_rails.rb` file with the following content:
323
+
324
+
```ruby
325
+
AjaxDatatablesRails.configure do |config|
326
+
# available options for db_adapter are: :pg, :mysql2, :sqlite3
327
+
# config.db_adapter = :pg
328
+
end
329
+
```
330
+
331
+
Uncomment the `config.db_adapter` line and set the corresponding value to your
332
+
database and gem. This is all you need.
333
+
334
+
If you want to make the file from scratch, just copy the above code block into a file inside the `config/initializers` directory.
335
+
336
+
300
337
#### Using view helpers
301
338
302
339
Sometimes you'll need to use view helper methods like `link_to`, `h`, `mailto`, `edit_resource_path` in the returned JSON representation returned by the `data` method.
0 commit comments