Hi i come cross problem where i want to assign an array in to another array
like i have this value save in DB of a attribute of table like
["rogid", "soni"]
a_array = []
after retrieving from DB i want to assign as it
a_array = ["rogid", "soni"]
after assign it should look like this after i display
["rogid", "soni"]
but when i display a_array it is like this
["[\"rogid\", \"soni\"]"]
how i can achive it like same as [“rogid”, “soni”]
Many many thanks for help
You could use a regex to parse the string:
rogid an soni on rubular
Im getting some odd ruby behavior here so i cannot confirm this answer right now, but im pretty sure you can handle it:
REGEX
my_pattern.match(my_string).to_awill return you desired array.Also dont forget pull
"[\"rogid\", \"soni\"]"from["[\"rogid\", \"soni\"]"]before using the regex.