Skip to content

Commit 68c7dcf

Browse files
author
Joel Quenneville
committed
added to rEADME
1 parent 0968543 commit 68c7dcf

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,25 @@ And then execute:
1616
$ bundle
1717

1818
## Usage
19-
19+
*The following examples assume that we are setting up ajax-datatables-rails for an index of users from a `User` model*
2020
### Model
2121
Run the following command:
2222

23-
rails generate ajaxdatatable <modelname>
23+
$ rails generate ajaxdatatable User
24+
25+
This will generate a file named `users_datatable.rb` in `app/datatables`. Open the file and customize in the functions as directed by the comments
26+
27+
#### Initializer
28+
```ruby
29+
def initialize(view)
30+
@model_name = User
31+
@columns = # insert array of column names here
32+
@searchable_columns = #insert array of columns that will be searched
33+
super(view)
34+
end
35+
```
36+
2437

25-
This will generate a file in `app/datatables`
2638
## Contributing
2739

2840
1. Fork it

0 commit comments

Comments
 (0)