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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:46:46+00:00 2026-05-27T15:46:46+00:00

This is probably a fairly simple thing to do – I have a site

  • 0

This is probably a fairly simple thing to do – I have a site with a news feed that shows various posts. There are also other pages that similarly show posts. Comments can be added to these posts directly from any of these pages.

What I need to do is redirect the user back to the URL they came from, once they’ve added a comment, and to the particular post they commented on (each post has an id of post-#{post.id}, so I’d just have to stick #post-2 or whatever to the URL.

If the post could not be saved, for whatever reason, I’d also like to have the content that the user had submitted pre-filled into the comment box after the redirect.

How can I do these two things? The first is the more important one..
I’d have to store the URL that the user is coming from in the session on the new action and redirect to this on the create action? How can I get the URL?

I’m on Rails 3.1 by the way.

Thanks for the help!

  • 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-27T15:46:47+00:00Added an answer on May 27, 2026 at 3:46 pm

    You could use redirect :back which will send the user back to the page that issued the request

    redirect_to :back
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There probably is a fairly simple and straight-forward answer for this, but for some
This probably has a simple answer, but I must not have had enough coffee
We have a fairly simple program that's used for creating backups. I'm attempting to
This is probably a fairly simple way to do it, but I ask since
I'm fairly new to Data binding & XAML, so this probably is fairly simple
Hey guys, sorry for this probably fairly simple question but I'm starting to get
Guys, this probably will be fairly simple, but how am I able to find
Hey, I am guessing that this is probably fairly trivial, but I am having
This is a fairly common problem, it probably has a name, I just don't
This probably sounds really stupid but I have noo idea how to implement jquery's

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.