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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:13:32+00:00 2026-05-18T03:13:32+00:00

I have a button_to that I want to perform a PUT action (there is

  • 0

I have a button_to that I want to perform a PUT action (there is only one thing that can be updated about this resource – it will be updated as being ‘acknowledged’, so there are no other form fields associated with firing the action).

This is in my view (the controller is given explicitly because the button is on a view that belongs to another controller):

<%= button_to "Acknowledged", :controller => 'practice_sessions', :id => @practice_session.id, :method => :put %>

In my routes file, the resource has been declared as a restful resource:

  resources :practice_sessions

The controller for this resource has a create and an update action, and the button_to above calls the create action. I want it to call the update action.

This comes through the log right before the create action fires:

Started POST "/practice_sessions?id=21&method=put" for 127.0.0.1 at 2010-11-17 08:52:46 +0000
  Processing by PracticeSessionsController#create as HTML
  Parameters: {"authenticity_token"=>"1EW0IlI38d0f4wST5azrCEZVZPfih7i0UvCGSF7eqbc=", "id"=>"21", "method"=>"put"}
  • 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-18T03:13:33+00:00Added an answer on May 18, 2026 at 3:13 am

    Your syntax is slightly off. button_to takes three arguments: the button title, an options hash, and an html_options hash. :method=>:put needs to go in html_options, while the route parameters need to go in options. So you can rewrite like so:

    <%= button_to "Acknowledged", { :controller => 'practice_sessions',
      :id => @practice_session.id}, 
      :method => :put %>
    

    When clicked the request should be handled by PracticeSessionsController#update

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

Sidebar

Related Questions

Hi i have have this form that i do no want to perform an
I have a button that I want to make disappear if anything is tapped
I have a datagrid that I want to add a button/s to at runtime.
I want to have a button that has numbers in the range 0 ...
I have a button that when i tap on it i want to invoke
I have a link that I want to look like a button so I
I have an array of strings that I want to use for button titles
I have a dialog preference with a button on it that I want to
I have a html form with no submit button. I want to submit that
I've a navigationcontroller. In my secondview, i want to have a button, that when

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.