Forum: Ruby on Rails acts_as_taggable and auto_complete

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
895715ccced713d61a5cce1d492a958d?d=identicon&s=25 Kenneth Love (Guest)
on 2006-02-28 21:06
(Received via mailing list)
I'm using the acts_as_taggable gem (who's site has gone AWOL
apparently) and I'm wanting to make it autocomplete. I, however, am
the absolute worst JavaScript person ever, so is there anyone out
there that can point me to a tutorial or give some good starting
points? Thanks!

Kenneth


--
=> the blog from beyond <=
=> www.eyeheartzombies.com <=
3dd4b52a0946bd698b1d1635a46ea3a3?d=identicon&s=25 Francois Beausoleil (Guest)
on 2006-02-28 22:06
(Received via mailing list)
2006/2/28, Kenneth Love <kennethlove@gmail.com>:
> I'm using the acts_as_taggable gem (who's site has gone AWOL
> apparently) and I'm wanting to make it autocomplete. I, however, am
> the absolute worst JavaScript person ever, so is there anyone out
> there that can point me to a tutorial or give some good starting
> points? Thanks!

<%= text_field_with_auto_complete('object', 'tag_names', {}, {:tokens
=> ' '}) %>

You need an implementation of auto_complete_for_object_tag_names in
your controller:
def auto_complete_for_party_tag_names
  @tags = Tag.find(:all, :conditions => ['name LIKE ?',
"#{params[:party][:tag_names]}%"])
  render :inline => "<%= auto_complete_result(@tags, 'name') %>",
:layout => false
end

See the docs for the #text_field_with_auto_complete method at:
http://api.rubyonrails.com/classes/ActionView/Help...

Hope that helps !
895715ccced713d61a5cce1d492a958d?d=identicon&s=25 Kenneth Love (Guest)
on 2006-02-28 22:43
(Received via mailing list)
Thanks a lot. Worked perfectly.

On 2/28/06, Francois Beausoleil <francois.beausoleil@gmail.com> wrote:
> You need an implementation of auto_complete_for_object_tag_names in
>
>
>


--
=> the blog from beyond <=
=> www.eyeheartzombies.com <=
This topic is locked and can not be replied to.