Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Signin/out implementation

sessions signin

  • Please log in to reply
2 replies to this topic

#1 uriklar

uriklar

    Passenger

  • Members
  • 4 posts

Posted 06 October 2013 - 08:00 AM

Hello all! I'm a rails newbie with a conceptual question:

I want to implement a signin/signout mechanism. I'm currently following Michael Hartl's RoR tutorial. The thing is, that tutorial goes about implementing sessions with a separate controller and views. I want my signin form to be on the homepage (meaning, I don't want a sessions/new.html.erb page).

What is the best way to achieve this? Should I use a helper? a module? is it possible to achieve this using a SessionsController?

I'm swimming in new territory so any help (or examples) would be very much appreciated. Thanks!

P.S. I'm using Rails 3



#2 Jamie

Jamie

    Controller

  • Moderators
  • 114 posts
  • LocationThe UK

Posted 06 October 2013 - 11:28 AM

Hey mate

 

First of all... Welcome to the forums.

 

I would still use a sessions controller to handle the requests but you can simply implement that form on the homepage where it will post to the sessions controller, do the magic and then sign you in.

 

Authentication has been put into many many gems such as Devise or Clearance (my 2 personal favs) which I would suggest checking out.

 

If you look at Twitter.. They have a dropdown sign in box which is the same principle you wish to conceive which posts to that controller. Only if there is an error (which isn't captured client side) would you see the sign in page. Which isn't such a bad thing.

 

Hope that's some help!


Rails developer based in Newcastle, UK.
Web app owner - Twitter lover

#3 uriklar

uriklar

    Passenger

  • Members
  • 4 posts

Posted 06 October 2013 - 01:41 PM

Hey Jaime,
Indeed that does help. And the twitter idea sounds good too. 
Thanks







Also tagged with one or more of these keywords: sessions, signin

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users