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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:30:37+00:00 2026-05-27T02:30:37+00:00

Can someone explain why I woud use rails link_to etc instead of straight HTML

  • 0

Can someone explain why I woud use rails link_to etc instead of straight HTML code? Given that they will render the same once they get to the browser – what is the actual benefit here?

<a href="index.html"><img id="logo" src="images/logo.png" alt="logo" /></a>

<%= link_to image_tag("logo.png", :alt => "logo", :id => "logo"), root_path %>              

Background – I was changing this in a template and stopped to think why am I doing this?

  • 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-27T02:30:38+00:00Added an answer on May 27, 2026 at 2:30 am

    In Rails 3.1, using the helper method would make use of the asset pipeline. For the URLs, that means that the images are postfixed with a checksum (this is called fingerprinting, at least in the Rails guide linked above). That allows to set the HTTP server cache expiration to a maximum – if the file content changes, it will result in another filename and thus force redownloading the file. Otherwise it’ll be served from the browser cache.

    Also, if you specify an asset host in your configuration, the helper methods will use this information – check out the documentation for image_url.

    As for link_to, well, I suppose you could also do something like <a href="<%= root_path %>">Link</a>, but using the ruby code is more elegant in my opinion.

    You should never hardcode the URL in HTML – it might change, and you really don’t want to go through your source code and change all references to index.html to home.html or anything like that.

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

Sidebar

Related Questions

Can someone explain the following code.. What will that return statement do. public byte[]
Can someone explain to me if I should use bcpow() instead of pow() and
Can someone explain why it's best use is for prototyping? Should it not be
can someone explain why the compiler accepts only this code template<typename L, size_t offset,
Can someone explain me the rationale behind having these two functions, instead of just
Can someone explain and give example code to do the following steps in my
Can someone explain why this code doesn't work? Intent i = new Intent(this.context, SomeClass.class);
Can someone explain that why do arithmetic operations on integral types in Java always
Can someone explain the below code. As per my reading, Myframe inherits wx.frame but
Can someone explain what this ajax code does? function ajaxProgress(){ //Math.random() is for bitchy

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.