title: My helper methods in controller
body: <p>My app should render html, to answer when a user clicks ajax-link.</p>
  
  <p>My controller:</p>
  
  <pre><code>def create_user
    @user = User.new(params)
    if @user.save
      status = 'success'
      link = link_to_profile(@user) #it's my custom helper in Application_Helper.rb
    else
      status = 'error'
      link = nil
    end
  
    render :json =&gt; {:status =&gt; status, :link =&gt; link}
  end
  </code></pre>
  
  <p>My helper:</p>
  
  <pre><code>  def link_to_profile(user)
      link = link_to(user.login, {:controller =&gt; "users", :action =&gt; "profile", :id =&gt; user.login}, :class =&gt; "profile-link")
      return(image_tag("/images/users/profile.png") + " " + link)
    end
  </code></pre>
  
  <p>I have tried such methods:</p>
  
  <pre><code>ApplicationController.helpers.link_to_profile(@user)
  # It raises: NoMethodError (undefined method `url_for' for nil:NilClass)
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>class Helper
    include Singleton
    include ActionView::Helpers::TextHelper
    include ActionView::Helpers::UrlHelper
    include ApplicationHelper
  end
  def help
    Helper.instance    
  end
  
  help.link_to_profile(@user)
  # It also raises: NoMethodError (undefined method `url_for' for nil:NilClass)
  </code></pre>
  
  <p>In addition, yes, I KNOW about :helper_method, and it works, but i don't want to overload my ApplicationController with a plenty of that methods</p>