Last Updated on November 30, 2019 by Christopher G Mendla
There are times when you need to store a hash/array in a field in a rails table.
By declaring a hash and putting it at the end of the params permit section, then the data from things such as a multi select will be stored as a hash. Adding => [] declares the field as a hash field.
def search_params
params.require(:search).
:summary,
:owner,
:category,
:file_name,
:doc_to_email,
:category => [],
:owner => [])