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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:49:17+00:00 2026-05-27T22:49:17+00:00

I have the following nested resources: resources :listings do resources :offers do member do

  • 0

I have the following nested resources:

  resources :listings do
    resources :offers do
     member do
       put "accept"
       put "reject"
     end
   end
 end

In my listings/show.html.haml, I have

= button_to "Make Offer", new_listing_offer_path(@listing)

Now, when I click button, rails generate a POST request, and thus an error:

Started POST "/listings/2/offers/new" for 127.0.0.1 
ActionController::RoutingError (No route matches "/listings/2/offers/new"):

If I refresh (GET request), then the page displays correctly.

I believe this incorrect routing only happens when I added two extra actions: accept and reject, which happens to be POST actions.

Is it a bug in Rails, or it is my fault? How should I prevent this error?

Thank you.

  • 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-27T22:49:18+00:00Added an answer on May 27, 2026 at 10:49 pm

    The button_to helper creates a form for you which by default will send a POST request to the URL you’ve specified (“/listings/2/offers/new”).

    The routing you’ve specified will not generate a route to handle a POST request to /new. You can inspect your generated routes and the verbs to which they will respond by running the “rake routes” task.

    If you are looking to merely link to the form, change your “button_to” to a “link_to” and add CSS for aesthetics.

    = link_to "Make Offer", new_listing_offer_path(@listing)
    

    (this GET would route to your OfferController’s new action)

    If you are looking to actually POST data, you will likely need to change your usage to:

    = button_to "Make Offer", listing_offers_path(@listing)
    

    (this POST would route to your OfferController’s create action.)

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

Sidebar

Related Questions

I have the following rails 3 nested resource: resources :books do resources :authors end
I have the following rails 3 nested models: resources :books do resources :authors end
I have the following nested resources in my routes.rb file. The inner resource specifies
I have the following routes defining certain resources: resource :account, :only => [:show] namespace
I have the following nested dictionaries: Dictionary<int, Dictionary<string, object>> x; Dictionary<int, SortedDictionary<long, Dictionary<string, object>>>
I have the following form for photo_album which uses the nested forms feature of
How can I count nested list elements in Prolog? I have the following predicates
Assume the following: we have class B, which is a private class nested inside
Hi currently I have a nested XMl , having the following Structure : <?xml
I am trying to create nested resources where the sub-resource doesn't have an existence

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.