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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:28:42+00:00 2026-05-28T06:28:42+00:00

Am learning rails the way most do, by implementing a blog. I’ve just put

  • 0

Am learning rails the way most do, by implementing a blog. I’ve just put tagging in and have got my article view to the point where it’s displaying clickable tags when you display an article. The issue is that the links are coming out like this;

http://localhost:3000/articles?tagged_with=development

I would prefer not to have the querystring, and instead have something like;

http://localhost:3000/articles/tagged_with/development

I can’t find anything relevant in the “routes inside out” guide on the rails site (lots of useful stuff in there, just not this!)

Complete code here:
https://github.com/mikeyhogarth/mikeyblog

Pertinant bits are;

the link in _article.html.erb:

<%= link_to tag, articles_path(:tagged_with => tag) %>

the articles index controller:

def index

 if(params[:tagged_with])
   @tag = params[:tagged_with]
   @articles = Article.tagged_with @tag
 else
   @articles = Article.all
 end

 respond_to do |format|
   format.html # index.html.erb
   format.json { render json: @articles }
 end
end

what is the rails best practice way of doing this? Do I need to implement a “tagged_with” action and create a helper or is there some rails routing magic that can sort this out in a jiffy?

EDIT: Eventually found the answer

  • 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-28T06:28:43+00:00Added an answer on May 28, 2026 at 6:28 am

    Try adding something like this to your routes (untested):

    match '/articles/tagged/:tagged_with' => 'articles#index', :as => :tagged_articles
    

    Then:

    link_to(tag, tagged_articles_path(:tagged_with=>"foobar"))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started learning Rails and I'm trying to build a post/like type
I have just started learning rails, tho i have a bit problem. I know
I have been interested in learning Rails for some time now and feel now
I'm learning Ruby on Rails and doing the contactlist thing, 20 minute blog and
Learning rails and something smells a little funny. I have the following form for
I'm learning Rails, and got into a little problem. I'm writing dead simple app
After learning power of Rails framework, I have started learning ruby. In Ruby, I
I'm a relative rails newbie, just getting started on learning how to DRY my
I'm just learning Ruby on Rails. I've read a few books, I've watched lots
I have a book called Learning Ruby and under the section for rails is

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.