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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:30:32+00:00 2026-05-22T03:30:32+00:00

This apparently doesn’t work: redirect_to post_path(@post, :params => params) Since Rails route helpers doesn’t

  • 0

This apparently doesn’t work:

redirect_to post_path(@post, :params => params)

Since Rails route helpers doesn’t allow you to set the params hash directly (from what I’ve read).

This could pose some problems:

redirect_to post_path(@post, params)

Since you would be forwarding :controller and :action parameters as well, which would take you to the same controller and action you came from. This is often not what you want.

This works, but is insufficient, since it is cumbersome in that it takes a lot of code to set all the params (except :action and :controller) to the existing params:

redirect_to post_path(@post, {:someparameter => params[:someparameter]})

So, what is the simplest and easiest way?

  • 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-22T03:30:33+00:00Added an answer on May 22, 2026 at 3:30 am

    You could easily forward all parameters except the ones you want to exclude, like this:

    redirect_to post_path(@post, params.to_hash.except(:controller, :action))
    

    But that would probably leave you with still sending through :authenticity_token, :_method, and other parameters like :id if you have a nested resource, which you might not want.

    Therefore, it seems that this is the easiest way, for most purposes is:

    redirect_to post_path(@post, params.to_hash.slice(:someparameter, :anotheparameteryouwant))
    

    Which lets you simply specify the params you want to send through (it excludes the rest), without a lot of code.

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

Sidebar

Related Questions

I didn't realize this, but apparently Python's strftime function doesn't support dates before 1900:
Apparently, this does not work. WHY ??????? I don't want to do all this
Since my cell phone apparently doesn't support JQuery , but does run the simple
So I want to do this: save_to_library(params) if params[:commit] == lib but save_to_library apparently
I have a custom menu in jQuery that apparently doesn't work with IE 8
I'm surprised that this question apparently doesn't yet exist. If it does, please help
I have tried using spl_object_hash , however it apparently doesn't work with function objects.
Paramiko's SFTPClient apparently does not have an exists method. This is my current implementation:
I've just solved another *I-though-I-was-using-this-version-of-a-library-but-apparently-my-app-server-has-already-loaded-an-older-version-of-this-library-*issue (sigh). Does anybody know a good way to verify
I'm being passed an object that returns System.Byte[*] when converted to string. This apparently

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.