I'm trying to assign a string literal to a variable using a ternary operator with the following code开发者_如何学运维 in the pre
block:
texta = "approve";
textd = "deny";
aAction = texta eq "approve" => "true" | "false";
dAction = textd eq "approve" => "true" | "false";
However, this is what comes across in the JavaScript:
var texta = 'approve';
var textd = 'deny';
var aAction = true;
var dAction = false;
Notice that aAction
and dAction
should be strings, but they are actually boolean literals.
Why is this happening?
One way to force it back into a string is with a beesting:
aActionStr = "#{aAction}";
dActionStr = "#{dAction}";
Doesn't answer the question as to why this happens, but it's a hack that will work in this case.
精彩评论