Sharagoz -- wrote: >>I'm a little confused > Checking what type of user is logged in is as simple as > current_user.class. > Rails doesnt "use a subclass", like its faking anything, the object is > truly an object of that class. If you do User.find(1).class it might > tell you that it is a moderator object or an admin object, or a user > object(if type is nil). > The magic lies in the fact that several models are stored in the same > database table. The models themselfs works like regular sub/super > classes. > > This can be a bit tricky to understand at first. The best way to learn > it is to actually try to implement it yourself. > > Once that is done and you know how tell which type of user is logged in, > you may want advice on how to implement role based authorization. This > link will help: > http://railscasts.com/episodes/188-declarative-authorization
I've found this thread really useful. I tried a small example last night and it worked :) it will help me on my next project so thanks guys. -- Posted via http://www.ruby-forum.com/. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.