I am trying to convert an array inputed from a form multiple select field into a string separating the elements with commas. The gem i am using requires a tag_field in the form of a string separated by commas, but my multiple select field creates an array. Strong parameters reject the array so I need to convert the array to a string. Here is the code I have now in my application controller, but it is not working.
def configure_devise_params
devise_parameter_sanitizer.for(:sign_up) do |u|
u[:tag_list].join(', ')
u.permit(:email, :password, :password_confirmation,
:profile_name, :how_did_you_hear, :first_name, :last_name, :type, :tag_list)
end
end
Before I was adding :tag_list, I had the following code that worked:
def configure_devise_params
devise_parameter_sanitizer.for(:sign_up) do |u|
u.permit(:email, :password, :password_confirmation,
:profile_name, :how_did_you_hear, :first_name, :last_name, :type)
end
end
How do I fix this? Thanks.