mardi 15 septembre 2020

Getting TypeError - no implicit conversion of Symbol into Integer when trying to save

I am upgrading an RoR API app from Rails 3 to Rails 6. In one of the forms, I am getting TypeError - no implicit conversion of Symbol into Integer error when saving.

This is my params defined:

def narrative_params
  name_params = (params[:narrative] || {})[:name].keys
  description_params = (params[:narrative] || {})[:description].keys
  params.require(:narrative).permit(:support_url, :guest_access_allowed, 
                   disable_navigation, :disable_new_window, :enable_social_sharing, :customer_id, :user_id, 
                  :support_url, narrative_image_ids: [:_id], sub_groups_id: [:_id], template_id: [:_id], 
                  name: name_params, description: description_params)
end

The data is getting saved to the database but the save method is returning this error. I have spent a lot of time on this, I don't understand what I am missing here. Please help.

Aucun commentaire:

Enregistrer un commentaire