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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:56:12+00:00 2026-06-11T12:56:12+00:00

I am trying to refine my article and giving my user flexibility to decide

  • 0

I am trying to refine my article and giving my user flexibility to decide what they want to view.

Here the models with relationship

  Article
    has_many :tags, through: :articletags
  ArticleTags
    belongs_to :article
    belongs_to :tags
  Tags
    has_many :article, through: articletags

Now the idea is the use would go in article and on the side see the tags.title which then give refresh the pages with Article where tags = “world”. Now i am trying to do this with scope but i am not to sure how to do it. Here my scope in my model

scope :by_tags, where(title => ?, "world news")

Here how i call it

<%= link_to (tag.title), articles_path(:scope => "test") %>

But obviously it doesn’t work how can i fix it?

  • 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-11T12:56:13+00:00Added an answer on June 11, 2026 at 12:56 pm

    View

    <%= link_to (tag.title), articles_path(:scope => tag.title) %>
    

    Model(Article)

    def self.by_tags(tag)
      joins(:tags).where('tags.title = ?', tag)
    end
    

    Controller

    def index
      @articles = Article.by_tags(params[:scope])
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to refine my C skills and have been thinking of trying to
I'm trying to create a multilevel search to allow user to refine the same
I'm trying to refine a search list so that when a user clicks on
Trying to copy the msdn refernce here doesn't work and gives an error I
I'm trying to refine my code by getting rid of unnecessary white spaces, empty
I'm having a bit of a problem trying to refine/refactor a LINQ to Entities
I am trying to refine algebraic expressions into a convenient form using Mathematica to
Hi I'm struggling do refine/refactoring a domain model and trying to move logic from
I am trying to refine my custom jquery plugin. I have asked this before
Using Enterprise Architect (version 7.5), I'm trying to refine the code generation for C#.

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.