I have a update method that has dynamic incoming parameters in order to update the attributes I'd first like to change the params. This is hard to explain so I'll post some code and try to step through it.
Update Method:
def update
@integration = current_account.integrations.find(params[:id])
attrs = params.require(:integration_webhook).permit(:filters)
if @integration.update_attributes(attrs)
flash[:success] = "Filters added"
redirect_to account_integrations_path
else
render :filters
end
end
The requires key is a dynamic parameter because sometimes it's integration_webhook and other times it's integration_pager_duty. So, I'd like to strip it of its integration type so I can just require integration like so attrs = params.require(:integration).permit(:filters)
. How can I handle dynamic params when trying to update? Because it's hardcoded I'll get this error if it changes param is missing or the value is empty: integration_pager_duty