text_field_with_auto_complete inside form_for

后端 未结 5 1835
既然无缘
既然无缘 2021-02-10 09:25

Simple question really - how do I use text_field_with_auto_complete inside a form_for block?

I\'ve tried doing f.text_field_with_auto_com

5条回答
  •  攒了一身酷
    2021-02-10 09:51

    I had this problem too, but the solution I used might not apply to you.

    Since the object I was querying in the autocomplete belonged to a different model, I used a fields_for like this, which solved the autocomplete problem.

    <% fields_for :model, @formobject.model do %>
    

    <%= text_field_with_auto_complete :object, :field, :skip_style => true %>

    <% end %>

    Good luck!

提交回复
热议问题