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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:38:11+00:00 2026-06-03T16:38:11+00:00

I have a button_to helper method in a view table that I cannot get

  • 0

I have a button_to helper method in a view table that I cannot get to work the way I need it. I am using it to delete a record in a different model than is building the table and I do not have the :id for but I do have other parameters that can find the proper record. Based on other questions here I think the following sytax should be the correct;

<%= button_to 'Remove',mailing_list_edit_path(:arg1 => "value1", :arg2 => "value2"),:method => :delete,:confirm => "are you sure?" %>

but I get this error when I click the button;

Routing Error
No route matches [DELETE] "/assets"
Try running rake routes for more information on available routes. 

Here is the entry in my routes.rb

resources :mailing_list_edits, only: [:create, :destroy]

And the action in my controller

def destroy
MailingListEdit.where(:att1 => params[:arg1], :att2 => params[:arg2]).delete_all
respond_to do |format|
format.html { redirect_to controller1_index_path(session[:remember_token]) }
end
end

What am I doing wrong?

  • 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-03T16:38:16+00:00Added an answer on June 3, 2026 at 4:38 pm

    I found a workaround, in case it will help someone else, here it is.

    The path helper would not work without an :id, so I included a dummy :id and now I am able to pass the two attributes I needed to find and destroy. So my button_to now looks like this;

    <%= button_to 'Remove',mailing_list_edit_path(:id => "foobar", :arg1 => "value1", :arg2 => "value2"),:method => :delete,:confirm => "are you sure?" %>

    Kind of a hack, but it works!

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

Sidebar

Related Questions

Using the rails button_to helper I'm trying to run the update method in a
I'm writing a custom helper method that will get used a lot and return
Ok, I have an in template function that get's submitted via method=POST. But I
I can't get my link_to helper, with :method => :delete to destroy object My
I have a listview that's populated by rows that get their data from a
I have an Rspec test for a helper method which requires access to my
I have the following HTMLHelper extension to create a submit button that would work
I need an advice on best practices for DRYing view code. I have three
I'm working on a simple note-taking/painting app. I have a view controller that works
I have used this custom Helper in My Razor View. @Html.Link(OpenewWindow, Constants.Value, new {

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.