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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:05:42+00:00 2026-06-03T13:05:42+00:00

how can i join the ruby code with the html code? I want that

  • 0

how can i join the ruby code with the html code? I want that the html “href” link with the path (ruby). Could somebody help me? For example: <li class="active"><a href="#">Home</a></li> , the href linked to Ruby <%= link_to "Home", root_path %> .

Ill want that my Button Home, for example is linked with the Ruby root_path.

HTML Code

>  <div class="navbar navbar-fixed-top">
>           <div class="navbar-inner">
>             <div class="container">
>               <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
>                 <span class="icon-bar"></span>
>                 <span class="icon-bar"></span>
>                 <span class="icon-bar"></span>
>               </a>
>               <a class="brand" href="#">My Workingtimes</a>
>               <div class="nav-collapse">
>                 <ul class="nav">
>                   <li class="active"><a href="#">Home</a></li>
>                   <li><a href="#about">Log In</a></li>
>                   <li><a href="#contact">Sign In</a></li>
>                 </ul>
>               </div><!--/.nav-collapse -->
>             </div>
>           </div>
>         </div>

RUBY CODE

<div id="container">

    <div id="content">
        <% if flash[:notice] %>
        <p id="notice">
            <%= flash[:notice] %>
        </p>
        <% end %>

        <% if flash[:alert] %>
        <p id= "alert">
            <%= flash[:alert] %> 
        </p>
        <% end %>
    </div>
    <div id="footer">
    <%= link_to "Home", root_path %> |
    <%= link_to "Sign In", new_user_path %> |
        <% if user_signed_in? %>
        <%= link_to "Logout", logout_path, method: :delete %> |
        <%= link_to "My Workingtimes", mytimes_path %>
        <% else %>
        <%= link_to "Login", login_path %>
        <% end %> 
        <%= yield %>
    </div>
</div>
  • 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-03T13:05:44+00:00Added an answer on June 3, 2026 at 1:05 pm

    You can run rake routes and see what, for instance, root_path points to.

    Unless you haven’t made any changes, it probably points to /, in which case you can have href = "/"

    This is assuming that you absolutely need to enter the path name in the HTML. Otherwise, I would highly recommend converting your .html to .html.erb and then use something like <%= link_to "Home", root_path %> as you had mentioned.

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

Sidebar

Related Questions

Here's a real quick example: puts File.join(nil, hello) Would output test.rb:4:in 'join': can't convert
i know nothing about ruby, can anyone help explaining what this script is doing
Can ruby lookup path to a binary like in bash or gnu makefile? Makefile
Possible Duplicate: Ruby on Rails: How can i join with a derived table? posts
Is it possible to join applescript lines into one (in ruby it can be
in F#, array.append can join two arrays; is there a way to append 2
In Vim, one can join two lines by typing capital J. However, these are
Can i join two tables using LINQ for NHibernate like I can do in
How can I join 2 lists of equal lengths (to produce a 3rd list
How can I join 2 Point3f arrays together? I have tried this but it

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.