I'm stuck in trying to get an embedded expression in ERB.
I'm trying to put @post into @httppost. However when I print @httppost I
get (notice the @post):
{"aps": {"badge": 1, "alert", #{@post}}, "sound": "cat.caf",
"device_tokens":
["455ab1b23cbfd97b7d2ef90a49d222e40f4c6c9b2570e84ff94fe4afeea12345"]}
It should say:
{"aps": {"badge": 1, "alert", "This is a test"}, "sound": "cat.caf",
"device_tokens":
["455ab1b23cbfd97b7d2ef90a49d222e40f4c6c9b2570e84ff94fe4afeea12345"]}
I put everything in my view to make it easier to troubleshoot:
I'm stuck in trying to get an embedded expression in ERB.
I'm trying to put @post into @httppost. However when I print @httppost I
get (notice the @post):
{"aps": {"badge": 1, "alert", #{@post}}, "sound": "cat.caf",
"device_tokens":
["455ab1b23cbfd97b7d2ef90a49d222e40f4c6c9b2570e84ff94fe4afeea12345"]}
It should say:
{"aps": {"badge": 1, "alert", "This is a test"}, "sound": "cat.caf",
"device_tokens":
["455ab1b23cbfd97b7d2ef90a49d222e40f4c6c9b2570e84ff94fe4afeea12345"]}
I put everything in my view to make it easier to troubleshoot:
You've got it wrapped in single quotes... which won't interpolate. You want double quotes... or in your case since you've got a lot of double quotes you probably don't want to escape... use the %Q method...