I am currently working on a project that has a jquery datatables frontend and am using the ajax-datatables-rails gem to handle the backend. After reviewing the examples they link to and am having a challenge.
I have a datatable and it displays data from a table, lets call it Foo, that has a has_one polymorphic relationship with 3 different tables. My search needs to search on a column in that polymorphic relationship.
def my_filter
->(column,value) { Arel.sql("Foo.bar.description").matches("%#{value}%")}
end
One thing I tried was to convert the Arel::Table (a is the arel table)
Foo.where(a[:id].not_eq(nil)).find(
:all,
:joins => "bar",
:conditions => ["bar.description LIKE %asd%", true]
).arel_table
However in this case I get a message stating it can't find the id on Foo.