Acts_as_taggable and auto_complete


#1

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 <=


#2

2006/2/28, Kenneth L. removed_email_address@domain.invalid:

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/Helpers/JavaScriptMacrosHelper.html#M000377

Hope that helps !


#3

Thanks a lot. Worked perfectly.

On 2/28/06, Francois B. removed_email_address@domain.invalid wrote:

You need an implementation of auto_complete_for_object_tag_names in


=> the blog from beyond <=
=> www.eyeheartzombies.com <=