I have been looking at Simple Datatables but the documentation and example provided are not very clear. It appears to implement jsonify and utilize a template handler but I am not sure. Also the provided code does not compile; is the author using some other gem to parse the views? For example, it says to put this in your search view...
@products.each do |product|
json << [product.name, product.manufacturer.name]
end
which I assuming has to be translated to...
<%= @products.each do |product| %>
<% json << [product.name, product.manufacturer.name] %>
<% end %>
but it comes back and says 'undefined local variable or method 'json' for class blah blah'
same type of deal for the index view. The example says to just throw this in your view,
%table#products
%thead
%tr
%th= Product.human_attribute_name :name
%th= Product.human_attribute_name :manufacturer
%tbody
but if I do that it simply puts that raw text in my view. Again, it seems like the author is using some gem to parse his views but not referencing it in the docs. Any thoughts? Thanks!
Edit:
Ok, so I got the table to load correctly by calling it as a table... duh...
<table class="products">
<thead>
<tr>
<th>Name</th>
<th>Manufacturer</th>
</thead>
<tbody></tbody>
</table>
but it is now telling me it has no data to load. I checked the route and /search works but /search.datatables comes back telling me there is no template. Thanks again,