-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unknown keyword problem #9
Comments
JB essentially calls to_json on whatever your template returns as a final value/object, so when you call to_json yourself, you're basically forcing JB to call to_json on an already JSON-ified string, which is why you're getting that 2nd error. I don't know if you have anything (aside from the basic hash you've shown us in your template), but I don't see why id as a key in a hash would cause JB or Ruby to interpret it as a variable rather than a key name. Have you tried using id as a string instead? ''' |
@binarydev I have tried the syntax like following: { "id": "" } It says { "id" => "" } it says |
Update: Problem solved! I had to add Original question: Did you ever figure this out? I'm running into the exact same problem. Here's the surrounding code Rails 5.1 shows along with the error message:
|
I am using rails 4.2.7.1. Basically when I set
{ id: ''}
value to .jb template file it saysunknown keyword: id
. Then I add.to_json
at and end of{ id: ''}
hash expression. But at this stage it produces bad JSON-like string which browsers do not understand."{\"id\":\"\"}\n}\n\n"
Due to the fact that there are special characters in this string browsers do not understand whether the string is JSON or not even if the server sends
Content-Type: application/json
header. Maybe there is a proper way but as I read from the documentation I could not find any way.The text was updated successfully, but these errors were encountered: