RailsCasts Pro episodes are now free!

Learn more or hide this

piga's Profile

GitHub User: piga

Comments by

Avatar

I have a problem in my project. I use this:
<%= text_field_tag :tag, nil, {"data-autocomplete-source": Tag.order(:name).map(&:name)} %>
and that outputs:

I need data-autocomplete-source to be array because of autocomplete. In rails console, Tag.order(:name).map(&:name) returns array. Thanks

Avatar

Hey I used this great video to search my posts by tags. This serch is working:
Tag.find_by_name!(name).posts
But instead this serch is not working:
Tag.find(:all, :conditions => ['name LIKE ?', "%#{name}%"]).posts
Thanks for help