Answers.Body: <p>Looks like it was an issue with character encoding. I copied the <code>{% cache unless craft.config.devMode %}</code> from <a href="https://craftcms.stackexchange.com/questions/105/what-are-the-best-practices-for-using-the-cache-tag">What are the best practices for using the {% cache %} tag?</a>.</p>
  
  <p>When I manually retyped out the conditional it worked properly.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-13T12:01:22.420Z
Answers.LastActivityDate: 2014-11-13T12:01:22.420Z
Answers.LastEditDate: 2017-04-13T12:51:00.200Z
Answers.UserDisplayName: KeironLowe
Body: <p>I'm trying to set up caching and have it disabled for my local environment using <code>{% cache unless craft.config.devMode %}</code>. This works fine on non-local environments, but on my local environment I'm getting the error <code>Method "devMode" for object "Craft\ConfigVariable" does not exist</code>. Even though it does, this is my config file:</p>
  
  <pre><code>return array(
      '*' =&gt; array(
          'addTrailingSlashesToUrls' =&gt; true,
          'omitScriptNameInUrls' =&gt; true,
          'enableCsrfProtection' =&gt; true,
          'cpTrigger' =&gt; 'example-admin',
          'siteUrl' =&gt; (isset($_SERVER["HTTPS"]) &amp;&amp; $_SERVER["HTTPS"] == "on") ? "https://" : "http://" . $_SERVER['HTTP_HOST'],
          'environmentVariables' =&gt; array(
              'basePath' =&gt; $_SERVER['DOCUMENT_ROOT'] . '/data/uploads/',
              'baseURL' =&gt; (isset($_SERVER["HTTPS"]) &amp;&amp; $_SERVER["HTTPS"] == "on") ? "https://" : "http://" . $_SERVER['HTTP_HOST'] . '/data/uploads/',
          )
      ),
      '.local' =&gt; array(
          'devMode' =&gt; true
      )
  );
  </code></pre>
  
  <p>If I <code>{{ dump(craft.config.devMode) }}</code> I get <code>bool(true)</code> so it is being set, it's just when being used in the cache conditional.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-11-13T11:58:14.970Z
Comments.Text: Strange. What does this do: `{% if craft.config.devMode %}Check DevMode{% endif %}`?
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-11-13T12:00:31.100Z
Comments.Text: That worked, must be character encoding as when I manually typed out `{% cache unless craft.config.devMode %}` it worked.
Comments.UserDisplayName: KeironLowe
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-11-13T12:02:12.920Z
Comments.Text: No solution to this, but what about setting a new variable `'cache' => true`? Then you can set it independently from dev mode.
Comments.UserDisplayName: carlcs
Tags: <conditional><devmode><caching>
Title: Config variable does not exist
ThreadText: # Config variable does not exist
  
  (Asked by: username_0 on 2014-11-13)
  
  I'm trying to set up caching and have it disabled for my local environment using `{% cache unless craft.config.devMode %}`. This works fine on non-local environments, but on my local environment I'm getting the error `Method "devMode" for object "Craft\ConfigVariable" does not exist`. Even though it does, this is my config file:
  
  ```
  return array(
      '*' => array(
          'addTrailingSlashesToUrls' => true,
          'omitScriptNameInUrls' => true,
          'enableCsrfProtection' => true,
          'cpTrigger' => 'example-admin',
          'siteUrl' => (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://" . $_SERVER['HTTP_HOST'],
          'environmentVariables' => array(
              'basePath' => $_SERVER['DOCUMENT_ROOT'] . '/data/uploads/',
              'baseURL' => (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://" . $_SERVER['HTTP_HOST'] . '/data/uploads/',
          )
      ),
      '.local' => array(
          'devMode' => true
      )
  );
  
  ```
  
  If I `{{ dump(craft.config.devMode) }}` I get `bool(true)` so it is being set, it's just when being used in the cache conditional.
  
  **Tags:** conditional, devmode, caching
  
  > **Comments:**
  > **username_1**: Strange. What does this do: `{% if craft.config.devMode %}Check DevMode{% endif %}`?  
  > **username_0**: That worked, must be character encoding as when I manually typed out `{% cache unless craft.config.devMode %}` it worked.  
  > **username_1**: No solution to this, but what about setting a new variable `'cache' => true`? Then you can set it independently from dev mode.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2014-11-13. Score: 5 | Accepted answer
  
  Looks like it was an issue with character encoding. I copied the `{% cache unless craft.config.devMode %}` from [What are the best practices for using the {% cache %} tag?](https://craftcms.stackexchange.com/questions/105/what-are-the-best-practices-for-using-the-cache-tag).
  
  When I manually retyped out the conditional it worked properly.
  
  
  ---
  
  