msgbartop
Just a little about development! Think before you write!
msgbarbottom

Reader's Comments

  1. |

    The LoginController doesn’t need the empty login action method. The template will be rendered without it.

    Although, I’d suggest moving do_login into login, and wrapping it with an if request.post?, having the form post to that action (remember that forms post to the rendered action by default, so you wouldn’t have to specify an :action on the form).

    Otherwise, consider a more RESTful approach — it looks like SessionController with #create (for login) and #destroy (for logout) actions is in vogue at the moment.

    Reply to this comment
  2. |

    Thanks for the comments Jeremy,
    I’ll write another example using your tips :D
    about the “login” and “do_login” method, I prefer this way because I need one less “if” in the code :D

    Reply to this comment
  3. |

    I agree with Jeremy. I’d rather have less methods in my controller than one less if statement. I’m just getting started with the RESTful stuff, and I’m not 100% sold on it yet, but I like the idea of a session controller.

    Thank you for creating a simple example and explaining it. Obviously, for real access control, you need to go a couple of steps further. Maybe you could show us that next.

    Reply to this comment
  4. |

    [...] A very simple login example with Rails | Urubatan’s Weblog (tags: rails rubyonrails authentication login example ruby ror webdev web development programming) [...]

    Reply to this comment
  5. |

    Zachary, I liked the idea, I´ll improve the example with a little of REST and with some Authorization too (this one, the main purpose id the authentication only :D )
    And will write another post about it, probably next week.
    Thanks for commenting.

    Reply to this comment
  6. |

    [...] Recent Comments Notebook para que? PortableApps.com! | Blog do Urubatan on Why do you need a laptop? Try PortableApps.comJos Hirth on Use your mobile phone to control your presentations with Open OfficeUrubatan on Recording screencasts with Linux (Ubuntu/Kubuntu)Tom on Recording screencasts with Linux (Ubuntu/Kubuntu)Urubatan on A very simple login example with Rails [...]

    Reply to this comment
  7. |

    Hey very nice work on this system. Well explained. This is for a very similar system, only the code was tacked on to a finished site. The login system is pretty much separate from the site, because the login system is only temporary.

    http://www.thewojogroup.com/2008/09/super-simple-login-with-rails/

    Reply to this comment
  8. |

    it is in working…..it has sucked!!!!!

    Reply to this comment

Leave a Comment