Skip to content

Instantly share code, notes, and snippets.

@james
Created April 12, 2010 17:11
Show Gist options
  • Save james/363781 to your computer and use it in GitHub Desktop.
Save james/363781 to your computer and use it in GitHub Desktop.
Consider this:
`= select_tag "blockstyles[#{blockstyle}]"`
Now consider
`blockstyle == "[Basic Text Frame]"`
resulting in http parameter name
`blockstyles[[Basic Text Frame]]`
which results in Rails turning that into
`"blockstyles"=>{"Basic Text Frame"=>""}`
As it thinks it's 'helpfully' interpreting the extra square brackets as a double hash opening, which of course I don't want, so discards.
Is there a way to escape the square brackets in the string so I get
`"blockstyles"=>{"[Basic Text Frame]"=>""}`
Oh, and if you're wondering why the square brackets have to be there, I can genuinely blame adobe for this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment