I can't find a clear explanation of what it means when a value/variable is surrounded by '"' and why it happens.
For example, I have a simple function which returns an array containing an id.
return [params[:id]]
For some reason, it returns:
["4"]
not:
[4]
which I would have expected.
Can someone explain what '"' is and why/how they are inserted?
Unicode
I believe it's something called unicode - a standardized way of outputting typography & character sets in digital media. Unicode takes many forms, ASCII being one of the most widely used.
The problem you have, as referred to in the comments, is that as you returned the pure param, you're getting back the string representation of its contents. Whilst the actual contents of the variable will be ["4"]
, HTML will treat it as ["4"]
If you want to output the returned data, you may want to try the [.raw()][2]
method in your view:
<%= raw( [data] ) %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With