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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:35:23+00:00 2026-05-20T15:35:23+00:00

I’m relatively new to Ruby on Rails. As of now have this working code

  • 0

I’m relatively new to Ruby on Rails. As of now have this working code in one of the views in my Rails 2.3.8 application:

 <% form_for(@configuration) do |f| %>
 <%= f.text_field :parameter_a %>
 <%= f.text_field :parameter_b %>
 <%= button_to( "Apply", {} , { :method => "put" } ) %>
 <% end %>

As expected pressing the “Apply” button calls update in the controller. Now I would like to have the button shown in a hyperlink style and I’m looking for most efficient way to do this.

Maybe there are other ways, but I didn’t figure out how to use link_to correctly. It never passed the updated values in the PUT request. If you’d recommend link_to, could you please provide some hints how to do it. This is the non-working code:

<%= link_to( "Apply", configuration_path( @configuration ), { :method => "put" } ) %>

Many thanks.

  • 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-20T15:35:24+00:00Added an answer on May 20, 2026 at 3:35 pm

    One way to do this is by using the html button element and some css. I much prefer this technique since it requires no JS. This can also be done on input tags, using either their type or their class to select them, but buttons are nicer 😉

    As an aside, you shouldn’t be using button_to there. Rails’ button_to tag is supposed to be used outside a form (because it builds it’s own form), you should use f.submit. It will generate an input with a type of submit. Or, you could use a button submit.

    Back to using a button tag, I prefer to create a helper:

    def submit_button(text)
      content_tag :button, text, :type => :submit
    end
    

    Then, once you’ve used that, you can make the button look like a link with this css:

    button {
      background-color: transparent;
      border: none;
      color: #1f44ff;
      text-decoration: underline;
    }
    
    button:hover {
      cursor: pointer;
    }
    

    You may need to use JS to get the hover state to work in some browsers, but it’s still better than using JS for the submission of the form.

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

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I have just tried to save a simple *.rtf file with some websites and
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

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.