Note that there are some explanatory texts on larger screens.

plurals
  1. POTagging with autocomplete in Rails
    primarykey
    data
    text
    <p>My (long, I apologize) question is a follow-on to: <a href="https://stackoverflow.com/questions/4937185/how-to-add-tagging-with-autocomplete-to-an-existing-model-in-rails/5008263#5008263">How to add tagging with autocomplete to an existing model in Rails?</a></p> <p>I am using <code>acts-as-taggable-on</code> and <code>rails3-jquery-autocomplete</code>, and trying to set up a system (much like Stack Overflow) where users begin to enter in a tag and suggestions appear in a drop-down box.</p> <h2>Goal</h2> <p>I am in the <b>answers</b>#new form and I want to see a list of tags that relate to <b>questions</b>. i.e. Imagine being on SO looking for new Rails questions to answer, and searching for <code>ra</code>. <code>Ruby-on-Rails</code> pops up, you click it, and you see a list of questions under RoR, any one of which you can answer.</p> <p>These are the steps I've taken.</p> <ol> <li>Installed both gems. Both seem to work on their own.</li> <li>Added <code>&lt;%= javascript_include_tag "ui/jquery.ui.position", "ui/jquery.ui.autocomplete", "autocomplete-rails.js", "rails.js", "application.js" %&gt;</code>. (I already have Jquery, UI Core and UI Effects.)</li> <li>Answers controller: I added at top <code>autocomplete :question, :tags, :full =&gt; true</code>. I also tried <code>autocomplete :tag, :name, :full =&gt; true</code>.</li> <li>Question.rb: <code>acts_as_taggable_on :tags</code>.</li> <li>View:<br> <code>&lt;%= form_tag new_answer_url, :method =&gt; "get" do %&gt;<br> &lt;%= autocomplete_field_tag "tag_list", 'tags', autocomplete_question_tags_answers_path %&gt;<br> &lt;% end %&gt;</code></li> </ol> <p>A simple autocomplete (no tagging) works (but it only works once per page load). With tagging, no success.</p> <h2>Problems</h2> <p>With lots of experimentation (and many hours) I am getting these problems:</p> <ol> <li>I get <code>NameError (unitialized constant Tag)</code> in server response to initial entry.</li> <li>With a non-taggable implementation (searching for the simple question text itself) I get a JQuery Autocomplete-style drop-down but my cursors cannot access the options with up/down. I have to click them with the mouse. Also, the dropdown doesn't disappear unless I reload the page!</li> <li>After the server responds with results once (only non-taggable is working as I mentioned), it doesn't respond again to key presses or changes in the text entry.</li> </ol> <p>I would greatly appreciate any help you are able to give. I have gone through a few tutorials step-by-step but no luck today.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload