Rails authentication

Home Forums Buffercode Forum Rails authentication

This topic contains 1 reply, has 2 voices, and was last updated by  Kushagra Sharma 1 year, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2846

    Neha Rastogi
    Participant

    I am developing a project in rails and stuck to give different authorities to different users
    Ex: admin , normal users, moderator ,editor etc
    If any ony knows about it then plz help me´╗┐
    I am using my own authentication system because it is preferred by Mr Rails book
    below is my code for authenticate

    protected
      def authorize
         unless User.find_by_id(session[:user_id])
           redirect_to login_url, :notice => 'You are not a Authorized User'
         end
      end
    #2847

    Kushagra Sharma
    Keymaster

    Hello Neha
    It’s always best practice to write a code from scrach if you are in learning phase or in other words if you just want to learn it’s mechanism .
    But if you are developing a real world application you should remember security is major issue so it’s recommended to use and understand Device gem with can-can authentication system.
    Search for Device and can-can on google.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.