Is there any way to allow Rails strong params to permit different data types? For example, I'm using react-bootstrap-typeahead and redux-form to create a form that allows users to select from provided values or create their own value. The provided values come from the database and are handed to the controller as an object with name and id whereas the user created values are passed as a string.
答案 0 :(得分:0)
A form's submitted values will be stored in params[:object] regardless. I'm still not sure what you're asking - can you post your create controller actions if that's what being called on submit?
答案 1 :(得分:0)
我最近做了
params.require(:note).permit(
fields: [:value, value: []]
)
这使我能够提交字符串和数组参数。
抱歉,我没有文档来支持我,我只是在自己学习ruby。希望这会有所帮助。