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

  • Home
  • SEARCH
  • 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 8358151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:42:32+00:00 2026-06-09T10:42:32+00:00

I am currently getting the following error on my post model which is under

  • 0

I am currently getting the following error on my post model which is under act_as_taggable_on for tags and channels.

undefined local variable or method `tag_list_on' for #
<ActiveRecord::Relation:0x007f9864675b48>

I seems that rails cannot detect the existence of tag_list_on or set_tag_list_on methods; however, it does detect the tagged_with method, whose source is located in the exact same module as the other files.

RubyMine can detect the existence of all of these methods fine btw.

Here is the section of code that I’m performing all of these operations on.

@posts = Post.tagged_with(params[:tags]).paginate(:page => params[:page]|| 1, :per_page => 20)
user_tags = @posts.tag_list_on(:tags)                                                         
custom_tags = user_tags - params[:tags]                                                       
@posts.set_tag_list_on(:customs, custom_tags)                                                 
@tags = @posts.tag_counts_on(:customs, :order => "count desc").limit(10)                      
@channels = @posts.tag_counts_on(:channels, :order => "count desc")                           
  • 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-06-09T10:42:34+00:00Added an answer on June 9, 2026 at 10:42 am

    tagged_with is a class method of Post, added by the acts_as_taggable_on gem.

    @posts in your code is an instance of ActiveRecord::Relation, not the Post class itself or any instance of it.

    There is no tag_list_on instance method in ActiveRecord::Relation, hence the error.

    tagged_with says it returns

    …a scope of objects that are tagged with the specified tags.

    tag_list_on and set_tag_list_on are instance methods of the Post class, added by the acts_as_taggable gem.

    You need to call tag_list_on and set_tag_list_on for each instance of @posts

    user_tags = []
    @posts.each do |post|
      user_tags = user_tags + post.tag_list_on(:tags) 
    end
    custom_tags = user_tags.uniq - params[:tags]
    
    # ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting undefined method `member' error in my following code Pls tell where
I am getting the following error when I post back a page from the
I'm currently getting a Could not load type UI.Administration.Site.master error message and I'm not
I just installed the plugin for Paperclip and I am getting the following error
I am getting following error: COM object that has been separated from its underlying
I'm getting the following error after shuffling an array, then trying to loop through
I am getting the following error message in my FF console: uncaught exception: Syntax
I'm current following the Rails Getting started guide, including creating a blog with post
I'm getting the following error when I try to retrieve the form results in
I'm getting the following error when trying to build my app using Team Foundation

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.