title: How do I call a method in application helper from a view?
body: <p>I defined a custom method in application_helper.rb file like the following:</p>
  
  <pre><code>def rxtrnk(line)
      rxTRNK = /\w{9,12}/m
      trnks = Array.new
      i = 0
      while i &lt;= line.size
          if line[i].match(rxTRNK)
              trnks[i] = line[i].scan(rxTRNK)
          end
          i += 1
      end
  
      return trnks
    end
  </code></pre>
  
  <p>Then I tried to call it from a view like so:</p>
  
  <pre><code>&lt;% @yo = rxtrnk(@rts)%&gt;
  </code></pre>
  
  <p>But I get an error page like this: </p>
  
  <pre><code>NoMethodError in TrunksController#routesperswitch
  
  undefined method `rxtrnk' for #&lt;TrunksController:0x7f2dcf88&gt;
  </code></pre>
  
  <p>I know this is a very newbie question, but I couldn't find solution from googling :(
  Thanks for your help</p>
  
  <p>edit/ here is the full application_helper.rb</p>
  
  <pre><code>module ApplicationHelper
       def rxtrnk(line)
      rxTRNK = /\w{9,12}/m
      trnks = Array.new
      i = 0
      while i &lt;= line.size
          if line[i].match(rxTRNK)
              trnks[i] = line[i].scan(rxTRNK)
          end
          i += 1
      end
  
      return trnks
    end
  
  end
  </code></pre>