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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:02:42+00:00 2026-05-26T23:02:42+00:00

My aim is simply to display two optional URL parameters on an index page.

  • 0

My aim is simply to display two optional URL parameters on an index page.

0.0.0.0:3000/comparison –> show: empty comparison index page

0.0.0.0:3000/comparison/3 –> show:

3

0.0.0.0:3000/comparison/3/4 –> show:

3
4 

I created a controller + view for “comparison”

rails generate controller comparison

and I added

match ':comparison/:index(/:a(/:b))'

to the routes.rb and added an index.html.erb displaying both parameters

<%= @a %>
<%= @b %>

my controller looks like this, simply forwarding the parameters to the view

class ComparisonController < ApplicationController
  def index 
    @a = params[:a]
    @b = params[:a]
  end
end

With this I am getting a routing error, e.g.

Routing Error

No route matches [GET] "/comparison/3/4"

How do I get the routing right?

  • 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-26T23:02:43+00:00Added an answer on May 26, 2026 at 11:02 pm

    Try this route (assuming Rails version 3.x):

    match 'comparison(/:a(/:b))' => "comparison#index"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created a Facebook page and implemented an application for it too. Now, my
Im really getting lost using the whole CountDownTimer my aim is too simply restart
I have added a subreport to my report. The aim is simply to hide
I'm using Python Google App Engine to simply fetch html pages and show it.
I'm working on a simple crawler in Python. The aim is to create a
AIM: I would like to tail the last line of the file.txt and input
Aim : To convert a integer value first to hexstring and then to byte[].
AIM: To output the contents of a log file line by line newest at
AIM: I would like to set the below function to call every 5 seconds.
AIM : Convert a resultset to XML and assign the result to a variable

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.