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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:11:18+00:00 2026-06-17T13:11:18+00:00

How do I redirect_to a certain path or page inside the view. I’ve read

  • 0

How do I redirect_to a certain path or page inside the view. I’ve read that redirect_to is an ActionController something, and cannot be used in the view. How can I do this in the view using only Rails, and how can I in addition to this write the redirection inside the controller or the model or helper and then just writing in the instance variable inside the view. I am using Devise. I do not want to use Javascript nor JQuery. Just Rails!

I tried this:

class Post < ActiveRecord::Base
  attr_accessible :content, :title
  @Uchecker = user_signed_in?
  redirect_to user_session-path
end
  • 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-06-17T13:11:19+00:00Added an answer on June 17, 2026 at 1:11 pm

    When you use the *redirect_to* from a controller, instead of rendering a view, what it does is to render an http redirect

    Now if you want to do a redirection from the view, you can still use javascript

    <script type="text/javascript">
      window.location = "<%= user_session_path %>";
    </script>
    

    Not the best practice but it works, and its a common practice for intermediate pages (i.e. when you search for a trip, the trip search could take like 60 seconds, so you render a view where you show something to the user like you are searching for the best trip, and you do a javascript redirection, once the result is ready, the page is loaded).

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

Sidebar

Related Questions

I would like to know how I can redirect to a certain page (during
How can I make mod_rewrite redirect to a certain page or probably just throw
I have a link that looks like this in the object's show view: <%=
I want to detect certain browsers (IE6) and redirect them to a page that
I'm trying to figure out how I can make this page redirect to a
Using Wordpress.. I would like to redirect to a certain page on the site
I want to redirect all requests to a certain path on my server (/app)
In my app, I've got a little box that appears on every page, checking
I want to redirect to a certain page after an action (handled by a
I'd like to redirect certain URLs to a template page with the page being

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.