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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:56:03+00:00 2026-06-14T17:56:03+00:00

I have built some code that sorts an index page, using links in my

  • 0

I have built some code that sorts an index page, using links in my view. This works fine with links, and the working code is this:

<p>
  <%= link_to "Sentence", :controller => params[:controller], :action => params[:action], :type => '1', :class => "btn" %>
  <%= link_to "Question", :controller => params[:controller], :action => params[:action], :type => '2', :class => "btn" %>
  <%= link_to "Mnemonic", :controller => params[:controller], :action => params[:action], :type => '3', :class => "btn"  %>
  <%= link_to "Article", :controller => params[:controller], :action => params[:action], :type => '4', :class => "btn"  %>
  <%= link_to "Recommendation", :controller => params[:controller], :action => params[:action], :type => '5', :class => "btn"  %>
</p>

I would like to use a button group, and have built this example using Twitter Bootstrap in plain HTML:

<div class="btn-group">
  <button class="btn">Sentence</button>
  <button class="btn">Question</button>
  <button class="btn">Mnemonic</button>
  <button class="btn">Article</button>
  <button class="btn">Recommendation</button>
</div>

I cannot get the links converted to the button row. I have tried various styling options as well as attempting to use button_to. Ideally I would like to further style the buttons so that the currently selected one is a different color than the others.

EDIT

Output of HTML as suggested:

<div class="btn-group">
  <a href="/dialog_catagories?class=btn&amp;type=1">Sentence</a>
  <a href="/dialog_catagories?class=btn&amp;type=2">Question</a>
  <a href="/dialog_catagories?class=btn&amp;type=3">Mnemonic</a>
  <a href="/dialog_catagories?class=btn&amp;type=4">Article</a>
  <a href="/dialog_catagories?class=btn&amp;type=5">Recommendation</a>
</div>

The btn-group is preventing the buttons from rendering on the page for some reason, even though it is in the html.

EDIT 2

HTML code as per Varun’s answer:

<div class="btn-group">
  <a href="/dialog_catagories?html%5Bclass%5D=btn&amp;type=1">Sentence</a>
  <a href="/dialog_catagories?html%5Bclass%5D=btn&amp;type=2">Question</a>
  <a href="/dialog_catagories?html%5Bclass%5D=btn&amp;type=3">Mnemonic</a>
  <a href="/dialog_catagories?html%5Bclass%5D=btn&amp;type=4">Article</a>
  <a href="/dialog_catagories?html%5Bclass%5D=btn&amp;type=5">Recommendation</a>
</div>

SOLUTION

@Varun’s suggested answer worked in the end:

<div class="btn-group">
  <%= link_to "Sentence", "?type=1", :class => "btn" %>
  <%= link_to "Question", "?type=2", :class => "btn" %>
</div>

I am a bit unclear how the functionality is still working, as the following is not being explicitly passed:

:controller => params[:controller], :action => params[:action]

But it is working fine. Thank you.

  • 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-14T17:56:05+00:00Added an answer on June 14, 2026 at 5:56 pm

    Try this:

    <div class="btn-group">
      <%= link_to "Sentence", :controller => params[:controller], :action => params[:action], :type => '1', :html => { :class => "btn" } %>
      <%= link_to "Question", :controller => params[:controller], :action => params[:action], :type => '2', :html => { :class => "btn" } %>
      <%= link_to "Mnemonic", :controller => params[:controller], :action => params[:action], :type => '3', :html => { :class => "btn" } %>
      <%= link_to "Article", :controller => params[:controller], :action => params[:action], :type => '4', :html => { :class => "btn" }  %>
      <%= link_to "Recommendation", :controller => params[:controller], :action => params[:action], :type => '5', :html => { :class => "btn" } %>
    </div>
    

    Edit

    Try this:

    <div class="btn-group">
      <%= link_to "Sentence", "?type=1", :class => "btn" %>
      <%= link_to "Question", "?type=2", :class => "btn" %>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code which is built both on Windows and Linux. Linux at
We have a J2EE app built on Struts2+spring+iBatis; not all DAO's use iBatis...some code
I know this sounds confusing: I have just built some basic prev/next pagination for
I have built a custom component using some containers and a TileList. Now when
I have built a Java application that has some dependencies (~10). I would like
We have built a web application that accepts SOAP messages, does some processing, calls
I have a project that comprises pre-build Dll modules, built some time in the
We have some C# code that uses COM (its calling legacy code). When an
I have a wordpress site that was built for me by a developer some
I have code that returns an NSComparisonResult. My codes works great for sorting my

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.