Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3964898
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:23:24+00:00 2026-05-20T03:23:24+00:00

I’m trying to add tags to an Article model in a Rails 3 application.

  • 0

I’m trying to add “tags” to an Article model in a Rails 3 application.

I’m wondering if there is a gem or plugin that has adds both the “tagging” functionality in the model and also the auto-complete helpers for the views.

I’ve found acts_as_taggable but I’m not sure if that’s what I should be using. Is there something newer? I’m getting results from 2007 when I google acts_as_taggable

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T03:23:25+00:00Added an answer on May 20, 2026 at 3:23 am

    acts_as_taggable_on and rails3-jquery-autocomplete work nicely together to make a SO like tagging system see example below. I don’t think a suitable all in one option exists yet for rails.

    Follow these steps to get this all installed:

    1 . Backup your rails app!

    2 . Install jquery-rails

    Note: You can install jQuery UI with jquery-rails but I chose not to.

    3 . Download and install jQuery UI

    Choose a theme that will compliment your web design (be sure to test the autocomplete demo with the theme you choose, the default theme did not work for me). Download the custom zip and place the [zipfile]/js/jquery-ui-#.#.#.custom.min.js file into your app’s /public/javascripts/ folder. place the [zipfile]/css/custom-theme/ folder and all files into your app’s public/stylesheets/custom-theme/ folder.

    4 . Add the following to your Gemfile and then run “bundle install”

    gem ‘acts-as-taggable-on’
    gem ‘rails3-jquery-autocomplete’

    5 . From the console run the following commands:

    rails generate acts_as_taggable_on:migration
    rake db:migrate
    rails generate autocomplete:install

    Make these changes in your app

    Include the necessary javascript and css files in your application layout:

    <%= stylesheet_link_tag "application", "custom-theme/jquery-ui-1.8.9.custom" %>  
    <%= javascript_include_tag :defaults, "jquery-ui-#.#.#.custom.min", "autocomplete-rails" %>
    

    Controller Example

    EDIT: Made changes based on Seth Pellegrino’s comments.

    class ArticlesController < Admin::BaseController  
      #autocomplete :tag, :name  <- Old   
      autocomplete :tag, :name, :class_name => 'ActsAsTaggableOn::Tag' # <- New
    end
    

    Model Example

    class Article < ActiveRecord::Base
       acts_as_taggable_on :tags
    end
    

    Route.rb

    resources :articles do
      get :autocomplete_tag_name, :on => :collection    
    end
    

    View Example

    <%= form_for(@article) do |f| %>
      <%= f.autocomplete_field :tag_list, autocomplete_tag_name_articles_path, :"data-delimiter" => ', ' %> 
      # note tag_list above is a virtual column created by acts_as_taggable_on
    <% end %> 
    

    Note: This example assumes that you are only tagging one model in your entire app and you are only using the default tag type :tags. Basically the code above will search all tags and not limit them to “Article” tags.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.