My setup: Rails 2.3.10, Ruby 1.8.7
This is a simple question but I want to pass a boolean value for a field in a JSON string that will be interpreted by Rails as boolean, e.g., what do I use for “a” below? Is it 0 or 1 or “true” or “false” or ?
{
"a": ??,
"b": [1,2,3...],
"c": 3
}
Is there another way to test for true or false in Ruby besides comparing it to true, e.g.,
a = params[:a]
if a == true
Scott M is right on the JSON part. On the Rails end, I need to use this method to convert it into Rails boolean format