how to use single login page for users in four models -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3897b85e4354f2c44bf1b4a761fc6c0f%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
Robert Walker
2013-Jul-05 17:13 UTC
Re: how to use single login page for users in four models
ram kris wrote in post #1114502:> how to use single login page for users in four modelsYou have not given enough detail in your question to know what you''re asking. Are you saying that you have four different types of users? If so then why do you have four models instead of doing role based authorization having only one user model? If you really do have four different types of user then you might want to consider Single-Table-Inheritance (STI). I seriously doubt you need to go to this extreme though. I can''t give you a definitive answer from such an abstract question. There are many ways to solve a problem, but you haven''t even described the problem you''re trying to solve. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/fad9a633098f7b2b5f42973f2379ef70%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
mack gille
2013-Jul-09 13:14 UTC
Re: how to use single login page for users in four models
Robert Walker wrote in post #1114535:> ram kris wrote in post #1114502: >> how to use single login page for users in four models > > You have not given enough detail in your question to know what you''re > asking. > > Are you saying that you have four different types of users? If so then > why do you have four models instead of doing role based authorization > having only one user model? > > If you really do have four different types of user then you might want > to consider Single-Table-Inheritance (STI). I seriously doubt you need > to go to this extreme though. > > I can''t give you a definitive answer from such an abstract question. > There are many ways to solve a problem, but you haven''t even described > the problem you''re trying to solve.@Robert Walker plz clarify me i have face the same problem.i have two models employee(having 6 input fields),client(having 12 input fields),i need to authenticate them using devise.what i have to do single sign in form for both if it is solution let me know how is this,else by using two devises or any solution let me know thankyou @Robert Walker -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/251524cb7608f099f65d54678d2ebc8f%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
mack gille
2013-Jul-09 13:17 UTC
Re: how to use single login page for users in four models
Robert Walker wrote in post #1114535:> ram kris wrote in post #1114502: >> how to use single login page for users in four models > > You have not given enough detail in your question to know what you''re > asking. > > Are you saying that you have four different types of users? If so then > why do you have four models instead of doing role based authorization > having only one user model? > > If you really do have four different types of user then you might want > to consider Single-Table-Inheritance (STI). I seriously doubt you need > to go to this extreme though. > > I can''t give you a definitive answer from such an abstract question. > There are many ways to solve a problem, but you haven''t even described > the problem you''re trying to solve.@Robert Walker plz clarify me i have face the same problem.i have two models employee(having 6 input fields),client(having 12 input fields),i need to authenticate them using devise.what i have to do single sign in form for both if it is solution let me know how is this,else by using two devises or any solution let me know thankyou @Robert Walker -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0c9edc0239e351fceaf14a22358d1425%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
Walter Lee Davis
2013-Jul-09 14:13 UTC
Re: how to use single login page for users in four models
On Jul 9, 2013, at 9:17 AM, mack gille wrote:> Robert Walker wrote in post #1114535: >> ram kris wrote in post #1114502: >>> how to use single login page for users in four models >> >> You have not given enough detail in your question to know what you''re >> asking. >> >> Are you saying that you have four different types of users? If so then >> why do you have four models instead of doing role based authorization >> having only one user model? >> >> If you really do have four different types of user then you might want >> to consider Single-Table-Inheritance (STI). I seriously doubt you need >> to go to this extreme though. >> >> I can''t give you a definitive answer from such an abstract question. >> There are many ways to solve a problem, but you haven''t even described >> the problem you''re trying to solve. > > > > @Robert Walker plz clarify me > > i have face the same problem.i have two models employee(having 6 input > fields),client(having 12 input fields),i need to authenticate them using > devise.what i have to do single sign in form for both if it is solution > let me know how is this,else by using two devises or any solution let me > know > > thankyou @Robert WalkerThe simplest thing of all would be to have a single "User" model and a has_one sidecar model for the Client''s extra fields. That way you can have just one set of login / logout paths and not worry about the logged-in person''s underlying class. Using CanCan to manage the authorizations, you can allow an employee to see or do things that a client cannot, and vice-versa. Storing the "what kind of user this is" attribute in a column and switching permissions on that value is one of the simplest things to do in a multi-role application using CanCan. I recommend a quick read of the Wiki on that GitHub project. Walter> > -- > 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0c9edc0239e351fceaf14a22358d1425%40ruby-forum.com. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1A47DB05-DB18-4891-A3E7-13CDD559E076%40wdstudio.com. For more options, visit https://groups.google.com/groups/opt_out.
Tamara Temple
2013-Jul-10 05:19 UTC
Re: how to use single login page for users in four models
On Jul 9, 2013, at 6:14 AM, mack gille <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Robert Walker wrote in post #1114535: >> ram kris wrote in post #1114502: >>> how to use single login page for users in four models >> >> You have not given enough detail in your question to know what you''re >> asking. >> >> Are you saying that you have four different types of users? If so then >> why do you have four models instead of doing role based authorization >> having only one user model? >> >> If you really do have four different types of user then you might want >> to consider Single-Table-Inheritance (STI). I seriously doubt you need >> to go to this extreme though. >> >> I can''t give you a definitive answer from such an abstract question. >> There are many ways to solve a problem, but you haven''t even described >> the problem you''re trying to solve. > > > > @Robert Walker plz clarify me > > i have face the same problem.i have two models employee(having 6 input > fields),client(having 12 input fields),i need to authenticate them using > devise.what i have to do single sign in form for both if it is solution > let me know how is this,else by using two devises or any solution let me > know > > thankyou @Robert Walker >This is probably me just being crazy, but why have so many devise tables? You may indeed have different user types, but if they all need to log in, then why not have a single User table that handles the authentication that is common to all types? Do you really need different methods of logging your various types of users in? You can either then have different models for the 4 types, but they can all either inherit from User (which is the single table inheritance thing) -or- they can be separate models with their own relationships and such to the User table you use for authentication. If you really want to think about it, you don''t need to make this part of you application at all, and use Devise as a completely separate Rails Engine with it''s own models. All your application needs to deal with is authenticated users, and none of the business of actually authenticating them. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/44E7ED51-AAB6-43D3-BDF9-CBEC0F02E3B1%40gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
mack gille
2013-Jul-10 06:06 UTC
Re: how to use single login page for users in four models
@ Walter Davis thankyou can you give me the sample code or any link.I did not get any resource plz let me know. Thank you -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a853a21b00c4c2b14999521c65102be2%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
Walter Lee Davis
2013-Jul-10 14:26 UTC
Re: how to use single login page for users in four models
On Jul 10, 2013, at 2:06 AM, mack gille wrote:> @ Walter Davis thankyou > can you give me the sample code or any link.I did not get any resource > plz let me know. > Thank you >Here. Watch some movies. http://railscasts.com/episodes?utf8=✓&search=cancan Walter> -- > 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a853a21b00c4c2b14999521c65102be2%40ruby-forum.com. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/F566F8EE-938F-4452-A997-93EC1F7F580B%40wdstudio.com. For more options, visit https://groups.google.com/groups/opt_out.