ebfjunior-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2010-Dec-17 19:23 UTC
Devise with many models
Oops! :-) Have been looking like crazy for tutorials on STI (Single Table Inheritance) and polymorphic associations to devise and use with many models. I''m in trouble here, I have three models (''admin.rb'', ''pesquisador.rb'' and ''bolsista.rb''), the typical case of teacher, student and administrator.. But the devise works only with a model, usually ''user.rb'' as shown in many tutorials.. What I wonder is how can I relate the models so I can create a generic model ''usuario.rb''and use the devise, having an interface with administrative privileges .. Thanks in advance! :-D -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 17 December 2010 19:23, ebfjunior-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <ebfj_8-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> Oops! :-) > Have been looking like crazy for tutorials on STI (Single Table > Inheritance) and polymorphic associations to devise and use with many > models. > I''m in trouble here, I have three models (''admin.rb'', ''pesquisador.rb'' > and ''bolsista.rb''), the typical case of teacher, student and > administrator.. > But the devise works only with a model, usually ''user.rb'' as shown in > many tutorials.. > What I wonder is how can I relate the models so I can create a generic > model ''usuario.rb''and use the devise, having an interface with > administrative privileges ..I would suggest that you should be considering using the concept of Roles, so they are all users, with different roles. Google for Rails Roles and you will get many hits. You might like to look at Cancan also. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.