ruby on rails - ActiveAdmin Formtastic getting multi-select to work -


i know how make multi-select form stated in documentation. http://www.rubydoc.info/github/justinfrench/formtastic/formtastic/inputs/selectinput

f.input :name, :as => :select, :collection => ["justin", "kate"]  

it's not clear me had put inside permit_params in order form request go through.

i'm doing through company model. have

activeadmin.register company permit_params :name controller     def create       puts params       company = company.new(permitted_params[:company])       if company.save         redirect_to admin_companies_path       else         redirect_to new_admin_company_path, alert: 'please fill fields'       end     end form |f|     f.inputs       f.input :name, :as => :select, :collection => ["a","b","c"]      end   end end 

when submit form "b" , "c" selected, see following in params[:company]

"company"=>{"name"=>["", "b","c"]}, "commit"=>"create company", "controller"=>"admin/companies", "action"=>"create"} unpermitted parameter: name    (0.1ms)  begin transaction    (0.1ms)  rollback transaction 

it's not clear me in activeadmin, or formtastic documentation, need change in permit_params in order let through.

by way, can tell, toy example. after working, figure out how has_many associations. if it's easier figure out solution via path please let me know.

try this:

permit_params name: [] 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -