Skip to content

Commit d9f52d4

Browse files
author
Joel Quenneville
committed
added documentation for the model side of things
1 parent 8139a4c commit d9f52d4

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,45 @@ def initialize(view)
4848
end
4949
```
5050

51+
#### Data
52+
```ruby
53+
def data
54+
users.map do |user|
55+
[
56+
# comma separated list of the values for each cell of a table row
57+
]
58+
end
59+
end
60+
```
61+
62+
This method builds a 2d array that is used by datatables to construct the html table. Insert the values you want on each column.
63+
64+
```ruby
65+
def data
66+
users.map do |user|
67+
[
68+
user.f_name,
69+
user.l_name,
70+
user.bio
71+
]
72+
end
73+
end
74+
```
75+
76+
#### Get Raw Records
77+
```ruby
78+
def get_raw_records
79+
# insert query here
80+
end
81+
```
82+
83+
This is where your query goes.
84+
85+
```ruby
86+
def get_raw_records
87+
User.all
88+
end
89+
```
5190

5291
## Contributing
5392

0 commit comments

Comments
 (0)