title: Passing local variables to a view from controller
body: <p>I am not able for some reason to pass local variables to the show view...</p>
  
  <p>In my controller i have simply:</p>
  
  <pre><code>def show
    render template: "books/show", :resource =&gt; "Some text"
  end
  </code></pre>
  
  <p>In my view i print the following:</p>
  
  <pre><code>&lt;h1&gt;My local variable text: &lt;%= resource %&gt;&lt;/h1&gt;
  </code></pre>
  
  <p>And i am getting the following message:</p>
  
  <pre><code>undefined local variable or method `resource' for #&lt;#&lt;Class:0x00000118ebce90&gt;:0x00000118ec3498&gt;
  </code></pre>
  
  <p>I've tried the following syntaxes in the controller:</p>
  
  <pre><code>render template: "books/show", locals: { resource: "Some text" }
  render template: "books/show", locals: { resource =&gt; "Some text" }
  render template: "books/show", :locals =&gt; { resource: "Some text" }
  render template: "books/show", :locals =&gt; { resource =&gt; "Some text" }
  </code></pre>
  
  <p>Without any luck...</p>
  
  <p>Any clues ?</p>
  
  <p>Thanks!</p>