title: How to call methods defined in ApplicationController in models
body: <p>I have defined method in ApplicationController</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
     helper_method :get_active_gateway
     def get_active_gateway(cart)
       cart.account.gateways
     end
  end
  </code></pre>
  
  <p>When I am calling this method in model</p>
  
  <pre><code>class Order &lt; ActiveRecord::Base
     def transfer
       active= get_active_gateway(self.cart)
     end
  end
  </code></pre>
  
  <p>It throwing error <code>undefined local variable get_active_gateway</code>.</p>
  
  <p>So I wrote</p>
  
  <pre><code>class Order &lt; ActiveRecord::Base
     def transfer
      active= ApplicationContoller.helpers.get_active_gateway(self.cart)
     end
  end
  </code></pre>
  
  <p>Then it was throwing <code>error undefined method nil for Nilclass</code>.</p>
  
  <p>I am working in Rails 3.2.0.</p>