Hello everyone,

I am porting a web site similar to one I've built at work in .NET over to
rails, just for the sake of helping to learn Ruby and Rails in my free
time. The site has a sign in screen, and you can't go anywhere else in the
site until you've authenticated with a username or password.

I have a good understanding of how to authorize with something like
OmniAuth, but I'm not sure what the most elegant / "rails way" is to
redirect someone, should they attempt to access a RESTful URL. I am
familiar with redirect_to, and could use that by wrapping it in some sort
of global check_if_signed_in function that I could call at the top of
various controller methods.

Anyway, how is that typically done in Rails? Seems like something that
would come up a lot for many sites (online banking, facebook, etc all
require sign in prior to anything else).

Jeff

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Wa0j4wdafA0J.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.

Search Discussions

  • Hassan Schroeder at Jul 16, 2012 at 2:54 pm

    On Sun, Jul 15, 2012 at 1:36 PM, Jeff wrote:

    with redirect_to, and could use that by wrapping it in some sort of global
    check_if_signed_in function that I could call at the top of various
    controller methods.
    See: AbstractController::Callbacks::ClassMethods#before_filter

    And it might help to look at the way existing gems implement auth;
    see: https://www.ruby-toolbox.com/categories/rails_authentication

    HTH,
    --
    Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
    http://about.me/hassanschroeder
    twitter: @hassan

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJul 16, '12 at 8:39a
activeJul 16, '12 at 2:54p
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Hassan Schroeder: 1 post Jeff: 1 post

People

Translate

site design / logo © 2021 Grokbase