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 6010905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:10:59+00:00 2026-05-23T02:10:59+00:00

I want to create a tagging system like seen here on Stack Overflow or

  • 0

I want to create a tagging system like seen here on Stack Overflow or on Quora. It’ll be its own model, and I’m planning on using this autocomplete plugin to help users find tags. I have a couple of questions:

  1. I want tags to be entirely user-generated. If a user inputs a new tag by typing it and pressing an “Add” button, then that tag is added to the db, but if a user types in an existing tag, then it uses that one. I’m thinking of using code like this:

    def create
    
    @video.tags = find_or_create_by_name(@video.tags.name)
    
    end
    

    Am I on the right track?

  2. I’d like to implement something like on Stack Overflow or Quora such that when you click a tag from the suggested list or click an “Add” button, that tag gets added right above the text field with ajax. How would I go about implementing something like that?

I know this is kind of an open-ended question. I’m not really looking for the exact code as much as a general nudge in the right direction. Of course, code examples wouldn’t hurt 🙂

Note I am NOT asking for help on how to set up the jQuery autocomplete plugin… I know how to do that. Rather, it seems like I’ll have to modify the code in the plugin so that instead of the tags being added inside the text field, they are added above the text field. I’d appreciate any direction with this.

  • 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-23T02:10:59+00:00Added an answer on May 23, 2026 at 2:10 am

    mbleigh’s acts_as_taggable_on gem is a feature-complete solution that you should definitely look into a little more closely. The implementation is rock-solid and flexible to use. However, it is mostly concerned with attaching tags to objects, retrieving tags on objects, and searching for tagged items. This is all backend server stuff.

    Most of the functionality you are looking to change (based on your comments) is actually related more to your front-end UI implementation, and the gem doesn’t really do much for you there. I’ll take your requests one-by-one.

    1. If user inputs a new tag, that tag
      gets added, if user inputs an
      existing tag, the existing tag gets
      used. acts_as_taggable_on does this.
    2. Click a tag from suggested list to
      add that tag. This is an
      implementation issue – on the
      back-end you’ll need to collect the
      suggested list of tags, then display
      those in your presentation as links
      to your processing function.
    3. Autocomplete as user enters
      potential tag. You’ll use the jQuery
      autocomplete plugin against a list
      of items pulled off the tags table.
      With additional jQuery, you can
      capture when they’ve selected one of
      the options, or completed entering
      their new tag, and then call the
      processing function.
    4. Restrict users to entering only one
      tag. This will be your UI
      implementation – once they’ve
      entered or selected a tag, you
      process it. If they enter two words
      separated by a comma, then before or
      during processing you have to either
      treat it as one tag, or take only
      the text up to the first comma and
      discard the rest.
    5. When you process the addition of a
      tag, you will have to do two things.
      First, you’ll need to handle the UI
      display changes to reflect that a
      tag has been entered/chosen. This
      includes placing the tag in the
      “seleted” area, removing it from the
      “available” display, updating any
      counters, etc. Second, you’ll need
      to send a request to the server to
      actually add the tag to the object
      and persist that fact to the
      database (where the taggable gem will take over for you). You can either do this via
      an individual AJAX request per tag,
      or you can handle it when you submit
      the form. If the latter, you’ll need
      a var to keep the running list of
      tags that have been added/removed
      and you’ll need code to handle
      adding/removing values to that var.

    For an example of saving tags while editing but not sending to server/db until saving a form, you might take a look at the tagging functionality on Tumblr’s new post page. You can add/remove tags at will while creating the post, but none of it goes to the database until you click save.

    As you can see, most of this is on you to determine and code, but has very little to do with the backend part. The gem will take care of that for you quite nicely.

    I hope this helps get you moving in the right direction.

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

Sidebar

Related Questions

I have polymorphic tagging model and I want to create tag_cloud for it, but
i wanted to create a tagging system, so i want to know how can
I want to create a Java application bundle for Mac without using Mac. According
I want to create my Rails application with MySQL, because I like it so
I want create a pdf using iText. The method which does this is a
I want create something that looks like the MSN Messenger chat forms. I am
i want create XML file here is my following code String fileName = jasstech.xml;
I want create 32 views like above view. so that what i modify in
I want create arrays with object keys in PHP, i.e. something like this: <?php
I want create subdomains like this: domain.com/type/city An examples: domain.com/restaurants/new_york domain.com/hotels/new_york domain.com/restaurants/chicago I have

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.