{"id":3156,"date":"2014-03-16T23:00:05","date_gmt":"2014-03-16T23:00:05","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/16\/problem-about-select2-rails-collection-of-common-programming-errors\/"},"modified":"2014-03-16T23:00:05","modified_gmt":"2014-03-16T23:00:05","slug":"problem-about-select2-rails-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/16\/problem-about-select2-rails-collection-of-common-programming-errors\/","title":{"rendered":"problem about select2-rails-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/be96ab7812508b07cacd88b34554e939?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJJD<br \/>\nruby-on-rails ruby-on-rails-3 simple-form jquery-select2 select2-rails<br \/>\nThis select2 jquery library looks awesome. There is a Rails gem but it is very light on the documentation. I would like to generate a simple multiple drop-down menu, using autocomplete. How do I do that?This is my simple_form_for call:&lt;%= f.input_field :neighborhood_names, url: autocomplete_neighborhood_name_searches_path, as: :autocomplete, data: { delimiter: &#8216;,&#8217;, placeholder: &#8220;Where do you want to live?&#8221;}, multiple: true, id: &#8220;selectWhereToLive&#8221;, class: &#8220;span8&#8221; %&gt;I have successfully inst<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/843473dc1738adb0ef54d450243d8955?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nCaner \u00c7akmak<br \/>\njquery-select2 select2-rails<br \/>\nI&#8217;m using Select2 with Rails and Mongoid and I have Sunspot Solr on the server side to do the searching. What I&#8217;m trying is to filter the data from mongo by solr, get that data by ajax request and group the results according to parent-child hierarchy. What I can&#8217;t figure out is when I search for a child and if there are multiple child results, the parent category is occuring multiple times. Please read below for more info:Here is my data in Mongo DB{ &#8220;_id&#8221; : ObjectId(&#8220;5209eb465a721ae827c661de&#8221;),<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>JJD ruby-on-rails ruby-on-rails-3 simple-form jquery-select2 select2-rails This select2 jquery library looks awesome. There is a Rails gem but it is very light on the documentation. I would like to generate a simple multiple drop-down menu, using autocomplete. How do I do that?This is my simple_form_for call:&lt;%= f.input_field :neighborhood_names, url: autocomplete_neighborhood_name_searches_path, as: :autocomplete, data: { delimiter: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3156","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3156","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3156"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3156\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3156"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}