Filter activeadmin with hstore

前端 未结 2 1617
萌比男神i
萌比男神i 2021-01-24 04:10

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

2条回答
  •  耶瑟儿~
    2021-01-24 05:06

    You could just create a Formtastic custom input for the HStore Datatype. If you don't want the Hstore values to be editable this should be sufficient (you could additionally set the the input field to read-only with input_html_options):

    class HstoreInput < Formtastic::Inputs::StringInput
    
    end
    

    This will break the attribute values on write though.

提交回复
热议问题