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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:47:11+00:00 2026-05-22T21:47:11+00:00

This is probably a very simple question. I am new to Rails and have

  • 0

This is probably a very simple question. I am new to Rails and have just hit my first major roadblock.
I have two controllers, Groups and MembershipRequests. When someone submits a MembershipRequest, the admin of the Group has the option to accept or deny the request. In my MembershipRequests controller, I have two methods: accept and deny. They both work, but now I’m unsure of dealing with my routes.

This is the relevant part of my routes.rb:

resources :groups do
  member do
    get 'members'
    resources :membership_requests do
      member do
        post 'accept'
        post 'deny'
      end
    end
    ...
  end
end

Okay, onto my real question: I want to be able to accept and deny requests without an additional page. I want to use JavaScript to use a button on my MembershipRequests index page where the admin can accept or deny the requests.

Here’s my erb code for the accept and deny buttons:

<%= link_to "Accept", :controller => 'membership_requests', :action => 'accept', :confirm => 'Are you sure?' %>

<%= link_to "Deny", :controller => 'membership_requests', :action => 'deny', :confirm => 'Are you sure?' %>

Clicking either of these links give me the
No route matches "/groups/1/membership_requests/1/{accept,deny}"
just like I would expect. But I do not know how to get around this. 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-22T21:47:12+00:00Added an answer on May 22, 2026 at 9:47 pm

    I think, link_to should also have :method => :post because you’re mapping it to a custom (non-RESTful) action (that’s just an assumption) and :remote => true, to tell rails that this link uses unobtrusive JS.

    This screencast might help, or at least give a starting point.

    Oh, and yes. As Ryan suggests, you’d better use something like this:

    @requests.each do |request|
      link_to "Accept", membership_request_accept_path(request), :confirm => 'Are you sure?', :remote => true
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a very simple question, I apologise - I'm new to rails.
This is probably a very simple question to answer. i am new to Rails
I'm new to Xcode. This is probably a very simple question to you, but
I'm new to nuget and this is probably a very simple question but I
This is probably a very simple question so please forgive my ignorance, but can
This is probably a very simple question but I'm a little confused how this
This is another probably very simple question, but I haven't been able to find
I know this is probably a very simple question but how would I do
This is probably a very simple Object Oriented Programming question. What I am trying
This is probably a very simple question for you SQL folks out there. I

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.