Note that there are some explanatory texts on larger screens.

plurals
  1. POjade ghost property
    text
    copied!<p>The template:</p> <pre><code>p= user </code></pre> <p>Outputs:</p> <pre><code>&lt;p&gt;{ admin: "true", human: "Foo Bar" }&lt;/p&gt; </code></pre> <p>(among some other stuff that usually isn't seen by the the user but is used to render different parts of the layout (or not) depending on various factors)</p> <p>The template:</p> <pre><code>p= user.human </code></pre> <p>Outputs:</p> <pre><code>&lt;p&gt;Foo Bar&lt;/p&gt; </code></pre> <p>As expected so far. However, the template:</p> <pre><code>p= user.admin </code></pre> <p>Outputs:</p> <pre><code>&lt;p&gt;&lt;/p&gt; </code></pre> <p>I have no idea how this is even possible. The property is there when I output the entire object, but it disappears when I try to output just that property.</p> <p>I've also tried using <code>user['admin']</code> instead of <code>user.admin</code>, but that doesn't work either.</p> <p>First question: how is this happening? Second question: how do I fix it?</p> <p><strong>Update 1:</strong> The pattern <code>p #{user.admin}</code> has the same effect, and <code>p= user.admin.toString()</code> results in a 500 error claiming <code>'user.admin' is not defined</code>. Furthermore, <code>JSON.stringify(user.admin)</code> also results in the empty p tag (as in <code>p= user.admin</code> and <code>p #{user.admin}</code>)</p> <p><strong>Update 2:</strong> <code>p= JSON.stringify(user)</code> <em>does</em> output the 'admin' property: <code>{"admin":"true","human":"Foo Bar"}</code> but iterating over <code>user</code> with <code>each value,key in user</code> does <em>not</em> output the 'admin' property. The output is extremely long in that case as it includes a bunch of functions and other things, but I used ctrl+f to search through the output and could not find 'admin'.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload