title: undefined local variable or method error with rails
body: <p>I have a method in controller -  </p>
  
  <pre><code>def undo_link
    view_context.link_to("undo", revert_version_path(@page.versions.scoped.last), :method =&gt; :post)
  end
  </code></pre>
  
  <p>But when i call it in views with  <code>"#{undo_link}"</code> . I get the 
  undefined local variable or method error .</p>
  
  <p>what am i doing wrong ?</p>
  
  <p>Update : Here the revert method in the controller </p>
  
  <p>okay but then this is the revert method i got in the controller</p>
  
  <pre><code>def revert
    @version = Version.find(params[:id])
    if @version.reify
      @version.reify.save!
    else
      @version.item.destroy
    end
    link_name = params[:redo] == "true" ? "undo" : "redo"
    link = view_context.link_to(link_name, revert_version_path(@version.next, :redo =&gt; !params[:redo]), :method =&gt; :post)
    redirect_to :back, :notice =&gt; "Undid #{@version.event}. #{link}"
  end
  </code></pre>