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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:09:18+00:00 2026-05-25T15:09:18+00:00

I have a REST resource called ‘requests’ as follows: resources :requests, :only => [:new,

  • 0

I have a REST resource called ‘requests’ as follows:

resources :requests, :only => [:new, :create, :destroy]

I have a page where the User selects a Group to join. This means they want to create a ‘NEW’ request.

I want to pass the ID of the group along with the link but its a REST resource.

<%= link_to "Join", new_request_path %>

But how can I add an id to this link?

Rails 3.

  • 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-25T15:09:18+00:00Added an answer on May 25, 2026 at 3:09 pm

    A simple way to do it would be to (assuming the group you join has id as ‘5’)

    link_to "Join" , new_request_path(:group_id => '5') 
    

    and access it in the controller action as params[:group_id].

    But this would not be very RESTful or Rails ‘ish’. If you can model it as if requests belong to a group . then you should be able to do (assuming you want to join @group):

    link_to "Join" , new_group_request_path(@group)
    

    Read up a little about Nested Resources and nesting routes in rails 3. There are so many articles there if you google for it.

    Of course the above would force you to change the way your have designed your models. But then maybe thats good!

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

Sidebar

Related Questions

I have a REST resource called Greetings. Here is my routes file: resources :greetings
I have a scenario in which I have REST API which manages a Resource
am new to Json so a little green. I have a Rest Based Service
I have a RESTful Rails application with a resource called Foo. I'm trying to
I want to have a REST resource for Foo and I want to be
I have some code as a rest resource : @GET @Produces ( { application/json
How do we read from a url resource. I have used the https://github.com/Kissaki/rest.go api
I'm working on a REST server. I have an order RESOURCE. From my understanding
I have a rest resource with a method that should return some data as
I have a rest resource to which files can be uploaded. @Path(/rest/input) public class

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.