Working twitter-typeahead example?

前端 未结 2 882
情书的邮戳
情书的邮戳 2020-12-16 06:56

I\'m trying to install the twitter-typeahead-rails gem into my app. I\'ve followed several different tutorials but all of them result in errors.

Does an

2条回答
  •  春和景丽
    2020-12-16 07:29

    The accepted answer is not completely correct.

    There seem to be 2 different gems doing roughly the same thing:

    bootstrap-multiselect-rails is currently on version 0.9.9 in the gem repository and has a different asset require structure as mentioned in the post. This gem's assets need to be included as:

    In application.js:
    //= require bootstrap-multiselect
    
    In application.css:
    *= require bootstrap-multiselect
    

    More on Git: https://github.com/benjamincanac/bootstrap-multiselect-rails

    Alternatively, there is the twitter-typeahead-rails gem, currently on version 0.11.1 which seem to need to be used and included as described in the rest of the accepted answer.

    More on Git: https://github.com/yourabi/twitter-typeahead-rails

    Both gems seem to be last updated about 5-6 months ago at the moment of writing this.

    Finally, the remote URL specified in the Bloodhound JS is incorrect:

    remote: '/typeahead/%QUERY'
    

    Needs to be

    remote: {url: '/typeahead/%QUERY', wildcard: '%QUERY'}
    

    Hopefully this helps someone

提交回复
热议问题