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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:13:33+00:00 2026-05-31T04:13:33+00:00

I have a simple menu that looks like this: <ul class=menu> <li class=active><a href=<%=

  • 0

I have a simple menu that looks like this:

<ul class="menu">
     <li class="active"><a href="<%= root_path %>">Home</a></li>
     <li class=""><%= link_to 'Feeds' , feeds_path %></li>
     <li class=""><%= link_to 'Accounts' , accounts_path %></li>
</ul>

Class “active” is the style to mark my current page.

I have two questions:
1. How do I “tell” the app what page I am on and ask it to “change” the class to active?
2. Is there a better way to create this menu (maybe driven by the controller or a db table)?

I realize this is a newbie question, but I have been thinking about this for a few days now, have read some tutorials, but none of them really click.

Thanks for your help.

  • 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-31T04:13:34+00:00Added an answer on May 31, 2026 at 4:13 am

    I use the method current_page? to set my active link. It takes a path as its parameter. I create a hash of link texts and paths and iterate over it printing the links. That way I only have to call current_page? one time.

    There are gems that can help you, though. Look through these: https://www.ruby-toolbox.com/categories/rails_menu_builders

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model that looks something like this: public class SampleModel { public
I have a simple link in a menu <a id=Home href=Amico-Bio-Home-Page></a> to which i
I have a multi-level nav styled as an unordered list that looks like this:
I have a row of evenly-spaced navigation items, which looks like this: The currently
I have my shared user defaults plist that looks something like: menuItems (Array) Item
I have a v simple dialog box that I would like to display as
I have a simple navigation menu with plain html links that target different pages.
I have built a simple menu in jQuery http://vanquish.websitewelcome.com/~toberua/ Here is a sample of
I have a simple WPF application with a menu. I need to add menu
I have a simple list I am using for a horizontal menu: <ul> <h1>Menu</h1>

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.