ruby on rails - delete last value of a splitted string -
I want to look at a hash but the last value should be:
parameter controller Send to
{"User" => {"Email" = & gt; "A@a.fr, lol@lol.fr"} Method
def set_users @users = params [ : User] [: email] logger.debug "# {@ users.split (", "}". Each {| e | insert E}} "end log < / Strong>
a@a.fr Eligible @ Lol.fr ["a@a.fr", "lol@lol.fr"] The issue is that the #Eech value (["a@a.fr", "Lol@lol.fr"]) which is not in the hash
I will do this:
P
@ users.split (", ") [0 ..- 2] Meaning, take everything but ultimate. therefore:
logger.debug @ users.split (",") [0 ..- 2] .join (',') < / Pre>
You just need to:
logger.debug @users
Comments
Post a Comment