Skip to content

Commit 8139a4c

Browse files
author
Joel Quenneville
committed
added some code examples to readme
1 parent 68c7dcf commit 8139a4c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@ def initialize(view)
3434
end
3535
```
3636

37+
For `@columns`, assign an array of the database columns that correspond to the columns in our view table. For example `[users.f_name, users.l_name, users.bio]`. This array is used for sorting by various columns
38+
39+
For `@searchable_columns`, assign an array of the database columns that you want searchable by datatables. For example `[users.f_name, users.l_name]`
40+
41+
This gives us:
42+
```ruby
43+
def initialize(view)
44+
@model_name = User
45+
@columns = [users.f_name, users.l_name, users.bio]
46+
@searchable_columns = [users.f_name, users.l_name]
47+
super(view)
48+
end
49+
```
50+
3751

3852
## Contributing
3953

0 commit comments

Comments
 (0)