-
Notifications
You must be signed in to change notification settings - Fork 37
Closed
Description
I’ve found this brilliant gem a few days ago.
I have a cell with a JSON serialized array. I need to list these items in a DataTable cell and I also need to search through them. As easy as it is to implement each of these requirements, I have spent the better part of the day trying to figure out how to achieve both.
- For the display part I did
col :participants, partial: 'participants/table_item', partial_as: 'event'
and putin the partial.<ul> <% JSON::parse(event.participants).each do |p| %> <li><%= p %></li> <% end %> </ul>
- For the search part I’ve set up full text search in PostgreSQL so that
Event.search_participants()
does the searching and I can write:col :participants do |event| event.participants end.search do |collection, term, column, sql_column| collection = Event.search_participants(term) end
I would like to put these together, but I cannot as You cannot use partial: … with the block syntax
So I tried
col :participants do |event|
tag.ul do
JSON.parse(event.participants).each do |participant|
tag.li participant
end.search do |collection, term, column, sql_column|
collection = Decision.search_participants(term)
end
end
end
but this render just an empty <ul></ul>
. What am I doing wrong here?
Funnily I've skimmed through some old documentation too and it seems like overriding search_column
method would suffice in the past.
Metadata
Metadata
Assignees
Labels
No labels