My current setup involves a Rails API backend and VueJS integrated through Nuxt on the frontend.
In one of my forms, I am utilizing vue-multiselect for a select input. The options in the select dropdown are values from a different table, where I aim to display the name field but submit the ID.
Although I can successfully display the options in the dropdown and submit other form data, it seems that submitting the ID is causing issues.
The Rails console indicates an error regarding `distillery_id` not being accepted as a permitted parameter, despite having properly set this up in the controller.
Started POST "/api/v1/gins" for ::1 at 2019-02-01 13:25:38 +0000
Processing by Api::V1::GinController#create as HTML
Parameters: {"gin_name"=>"distillery_id", "description"=>"distillery_id should be submitted", "distillery_id"=>{"id"=>3, "distillery_name"=>"Gordon's"...}
Unpermitted parameter: :distillery_id
gins_controller.rb
...
def gin_params
params.require(:gin).permit(:gin_name, :alcoholic, :snippet, :description, :abv, :distillery_id)
end
...
new.vue
<template>
<section class="container">
...
</form>
</div>
This issue appears to be originating from Rails rather than Vue based on the console feedback. Any thoughts on what might be causing this discrepancy?