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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:35:00+00:00 2026-05-30T03:35:00+00:00

So I am creating a ruby on rails application and in my view I

  • 0

So I am creating a ruby on rails application and in my view I have a list of link_to with each being a different console

In my database table I have a field called console.

What I want to do is when a user clicks on a link e.g. Playstation 3, it will return back all records that have Playstation 3 listed in that table column.

I was wondering how I would go about doing this, I have tried searching on the internet but have not found anything similar.

It is for a project that I don’t have long to complete. I was owndering what I would state in the link to’s in the view and what I would put in the games_controller.

Any help would be much appreciated.

  • 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-30T03:35:01+00:00Added an answer on May 30, 2026 at 3:35 am

    The basic gist is to have a controller action which will return the list of games filtering by console. For example,

    # GamesController.rb
    def index
       @games = Game.find_by_console(params[:console])
    end
    

    Then you can create a link for any particular console as such:

    link_to 'XBOX', games_path(:console => 'XBOX')

    This should result in a GET request to the URL /games?console=XBOX

    If you’ve got a pre-defined set of consoles, you might look into making them into constants inside a Consoles module to avoid having to hardcode them everywhere.

    UPDATE:

    Since you are trying to implement both searching and filtering in the same chain, you need to make sure that find_by_console isn’t called if it’s not present.

    # GamesController.rb
    def index
       @games = Game.search(params[:search])
       @games = @games.find_by_console(params[:console]) unless params[:console].blank?
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a fast application with ruby on rails, and after doing a lot
I have been creating a website with Ruby on Rails, and will be hosting
I'm creating a Ruby on Rails application, and I'm trying to create/login/logout users. This
I have a ruby-on-rails application that wishes to utilise the tumblr gem for adding
I am creating a site in Ruby on Rails, I have two models a
im trying to understand the process of creating tables in ruby-on-rails 3. i have
I am trying to modify a database Migration in a Ruby on Rails application.
I have a twitter like web application written in Ruby on Rails that allows
So I am creating a time tracking application using Ruby On Rails and am
I am creating a web application with Ruby on Rails 3.1 (RC1). I am

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.