Skip to content

Instantly share code, notes, and snippets.

@joemsak
Created May 24, 2011 15:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joemsak/988968 to your computer and use it in GitHub Desktop.
Save joemsak/988968 to your computer and use it in GitHub Desktop.
Using jQuery TokenInput with ActsAsTaggableOn
<div class='field'>
<%= f.label :tag_list, "Tags" %>
<%= f.text_field :tag_list, :class => 'larger widest', :"data-pre" => @model.tags.map(&:attributes).to_json %>
</div>
#example_get_all_tags_path needs to route here. (name it something else obviously)
def tags
@tags = Model.tag_counts.where("tags.name LIKE ?", "%#{params[:q]}%")
respond_to do |format|
format.json { render :json => @tags.map(&:attributes) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment