title: Rails 4: What Goes in Controller and Model?
body: <p>I have been reading and watching few videos on learning Rails 4. All tutorials has their own code so, in my views, easy to follow. I can't seem to learn anything or remember few things so I have decided to use my own code and see if I could follow instead of using their code.</p>
  
  <p>So far I understand the Controller corresponds with the views:</p>
  
  <pre><code># In my controller
  def index
   @x = "I love Ruby"
  end
  </code></pre>
  
  <p>And in my views (index.html.erb)</p>
  
  <pre><code>&lt;% = @x %&gt; #=&gt; I love Ruby
  </code></pre>
  
  <p>That simple thing would work for the index page. Now what if want to refer other method calls in that view's index, how to do that? In the controller:</p>
  
  <pre><code>def index
   @x = "I love Ruby"
  end
  </code></pre>
  
  <p>Still within the controller's class:</p>
  
  <pre><code>def languages_i_hate
   languages = %w[
                   Perl
                   PHP
                   C#
                   C++ ]
  end
  </code></pre>
  
  <p>And in my index.html.erb:</p>
  
  <pre><code>&lt;%= These are the languages I hate to bits: #{languages_i_hate.upcase}!
  </code></pre>
  
  <p>I got undeclared method or variable "languages_i_hate"</p>
  
  <p>How do I call method names in a webpage?</p>