title: use gazay/gon in presenter object
body: <p>I'm using a presenter object to make some complex data available to my views. Part of the data I need there is intended to be rendered by javascript, and for this I would like to use the <a href="https://github.com/gazay/gon" rel="nofollow">gon gem</a> to share the data to the browser. </p>
  
  <p>This my (simple for now), <code>app/presenters/similarity_presenter.rb</code> object: </p>
  
  <pre><code>class SimilarityPresenter
    attr_reader :similarities
    def initialize(similarities)
      @similarities = similarities
      gon.histories = @similarities.each { |s| [s.id, s.data(10)] }
    end
  end
  </code></pre>
  
  <p>When I run my action: </p>
  
  <pre><code>  def index
      period = Period.default
      @similarity_presenter = SimilarityPresenter.new Similarity.all
    end
  </code></pre>
  
  <p>I get a <code>undefined local variable or method 'gon'</code>, </p>