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

  • Home
  • SEARCH
  • 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 252977
In Process

The Archive Base Latest Questions

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

redirect_to :controller=>’groups’,:action=>’invite’ but I got error because redirect_to send GET method I want to

  • 0
    redirect_to :controller=>'groups',:action=>'invite'

but I got error because redirect_to send GET method I want to change this method to ‘POST’ there is no :method option in redirect_to what will I do ? Can I do this without redirect_to.

Edit:

I have this in groups/invite.html.erb

<%= link_to "Send invite", group_members_path(:group_member=>{:user_id=>friendship.friend.id,  :group_id=>@group.id,:sender_id=>current_user.id,:status=>"requested"}), :method => :post %>

This link call create action in group_members controller,and after create action performed I want to show groups/invite.html.erb with group_id(I mean after click ‘send invite’ group_members will be created and then the current page will be shown) like this:

redirect_to :controller=>'groups',:action=>'invite',:group_id=>@group_member.group_id

After redirect_to request this with GET method, it calls show action in group and take invite as id and give this error

Couldn't find Group with ID=invite

My invite action in group

    def invite
@friendships = current_user.friendships.find(:all,:conditions=>"status='accepted'")
@requested_friendships=current_user.requested_friendships.find(:all,:conditions=>"status='accepted'")
@group=Group.find(params[:group_id])
 end

The solution is I have to redirect this with POST method but I couldn’t find a way.

Ugly solution: I solved this problem which I don’t prefer. I still wait if you have solution in fair way.

My solution is add route for invite to get rid of ‘Couldn’t find Group with ID=invite’ error.

in routes.rb

   map.connect "/invite",:controller=>'groups',:action=>'invite'

in create action

   redirect_to "/invite?group_id=#{@group_member.group_id}"

I call this solution in may language ‘amele yontemi’ in english ‘manual worker method’ (I think).

  • 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-11T21:43:23+00:00Added an answer on May 11, 2026 at 9:43 pm

    It sounds like you are getting tripped up by how Rails routing works. This code:

    redirect_to :controller=>'groups',:action=>'invite',:group_id=>@group_member.group_id
    

    creates a URL that looks something like /groups/invite?group_id=1.

    Without the mapping in your routes.rb, the Rails router maps this to the show action, not invite. The invite part of the URL is mapped to params[:id] and when it tries to find that record in the database, it fails and you get the message you found.

    If you are using RESTful routes, you already have a map.resources line that looks like this:

    map.resources :groups
    

    You need to add a custom action for invite:

    map.resources :groups, :member => { :invite => :get }
    

    Then change your reference to params[:group_id] in the #invite method to use just params[:id].

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

Sidebar

Ask A Question

Stats

  • Questions 247k
  • Answers 248k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer you can use the attribute selector to selct via name… May 13, 2026 at 8:46 am
  • Editorial Team
    Editorial Team added an answer The fold answers will work. However, if this is homework,… May 13, 2026 at 8:46 am
  • Editorial Team
    Editorial Team added an answer If your EditText is declared in the xml file, you… May 13, 2026 at 8:46 am

Related Questions

redirect_to :controller=>'groups',:action=>'invite' but I got error because redirect_to send GET method I want to
I am relatively new to ruby on rails, so this question might be easy.
I'm trying to create a registration form with Rails. It's working, but it doesn't
I'm trying to edit a form, the route is controller/id/action for edit so for
I've set up a resource in routes.rb : map.resource :papers which is reflected in

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.