I would like to use activeadmin filters with hstore:
In model I have got column amenities with Room.
I would like to do sth like this:
fil
With latest activeadmin
(which uses ransack instead of meta_search) it's possible to define a custom ransacker
for hstore field in a model:
class Room < ActiveRecord::Base
store_accessor :options, :amenities
ransacker :amenities do |parent|
Arel::Nodes::InfixOperation.new('->', parent.table[:options], 'amenities')
end
end
Then it can be used in activeadmin
for filtering:
ActiveAdmin.register Room do
filter :amenities_eq, label: 'Amenities', as: :select # ...
end