title: jQuery token input on Rails
body: <p>I'm trying to use the jQuery token input plugin with Rails and Mongoid.</p>
  
  <p>Using <a href="http://asciicasts.com/episodes/258-token-fields" rel="nofollow">this</a> Railscast as a reference I added the plugin to my app
  and I setup the various methods, etc.</p>
  
  <p>I created a method on my model that should return this data:</p>
  
  <pre><code>class TheModel
      def token_inputs
          { :id =&gt; _id, :name =&gt; name }
      end
  end
  </code></pre>
  
  <p>In my controller I do this:</p>
  
  <pre><code>class TheModelsController &lt; ApplicationController
      @models = TheModel.all
  
      respond_to do |format|
          format.json { render :json =&gt; @models.map(&amp;:token_inputs) }
      end
  end
  </code></pre>