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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:27:32+00:00 2026-05-13T13:27:32+00:00

I know that I can have a session after the user login. Also, I

  • 0

I know that I can have a session after the user login. Also, I created a helper method called “current_user”. I don’t want to other people which are not signed in can get access to the page. Apart from making doing this, how can I do?

I can do this to not allow people the get access to the content, but I don’t want the user within login see the blank page too.

<% if current_user%>
My Content
<% 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-05-13T13:27:33+00:00Added an answer on May 13, 2026 at 1:27 pm

    Make a before_filter that checks if the current_user variable is set, and redirects the user to some other place (root, signup page, something) if it is not. Something like this:

    class ApplicationController < ActionController::Base
      def login_required
        redirect_to('/') if current_user.blank?
      end
    end
    
    class MyController < ApplicationController
      before_filter :login_required, :only => :action_aviable_only_for_logged_in
    
      def action_aviable_only_for_logged_in
        ...
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that ScrollView can have only one Child but in my case I
I know that you can't have a constructor in an interface, but here is
I know that __stdcall functions can't have ellipses, but I want to be sure
I just want to know that can i make an application which have some
I'd like to know if there are any mechanism in Akka that can have
I know that I can use popToRootViewController if I have navigationController in my project
I recently came to know that in C++ pure virtual functions can optionally have
I have a problem with rotating. I know that I can rotate a Texture2D
I have a little problem with autoconf, I know that you can use configure.ac
In Xcode 4.2, I know that one can use the storyboard segue to have

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.