I have scoured the internet as best I can for this problem, but I am completely shafted by the keyword !binary as search engines (including stackoverflow's internal search!) strip the exclamation mark.
I am working through the Rails tuorial at http://ruby.railstutorial.org - whcih has for the most part been an excellent resource. One of the useful things that I have at the bottom of my application.html.erb page is:
<%= dump(params) %>
I am told that a particular scenario should output the following:
--- !map:ActiveSupport::HashWithIndifferentAccess
commit: Sign in
session: !ActiveSupport::HashWithIndifferentAccess
password: ""
email: ""
authenticity_token: BlO65PA1oS5vqrv591dt9B22HGSWW0HbBtoHKbBKYDQ=
action: create
controller: sessions
Instead I get the following:
--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
!binary "dXRmOA==": ✓
!binary "YXV0aGVudGljaXR5X3Rva2Vu": ItPS/PZ+avYOGD2ckict1urJpatw1HinrVyk385/Yt8=
!binary "c2Vzc2lvbg==": !ruby/hash:ActiveSupport::HashWithIndifferentAccess
!binary "dXNlcm5hbWU=": ''
!binary "cGFzc3dvcmQ=": ''
!binary "Y29tbWl0": Sign in
action: create
controller: sessions
Which is far less helpful.
I am assuming that rails has the option of outputting data as it is in memory (i.e. binary form) or it can decode the data and display it in plain text.
I am obviously getting the correct data, just in the wrong form.
The question is how do I get the plain text version?
The second question is why the heck does a site like stackoverflow not have a mechanism to include special characters in searches? Fundamental Fail IMO
Can you try changing from .dump to .inspect like this?
<%= params.inspect %>
I believe that's the string encoding for the key which is oddly represented as !binary
even though there are no non 7-bit ASCII characters in there. The values are encoded as base-64 to render them in plain-text:
"dXRmOA==".unpack('m')
# => ["utf8"]
This could be an artifact of your environment where the default string encoding is irregular.
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