Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RAILS email input with multiple=true
# simple_form sends params inside an array
# ["first@email.com,second@email.com"]
def email_cc_list=(list)
write_attribute(:email_cc_list,
Array.wrap(list).first.split(",").uniq.join(",")
)
end
# is it possible the array ever holds more than 1 value?
# Array.wrap(list).map { |l| l.split(",") }.flatten.uniq.join(",")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.