On 27 May 2013 06:15, Himanshu Prakash <vision2...@gmail.com> wrote: > Hi, > Agree to Colin & Emil. I think this is the good opportunity to implement > Single Table Inheritance(STI) pattern in your application.
Generally I think that the additional complication of using STI for a simple situation such as we have here is not worth the effort. I would just use a single model. Try it both ways and see which you like best. Colin > > -Himanshu > > On Sat, May 25, 2013 at 8:32 PM, Emil S <emil.so...@gmail.com> wrote: >> >> In agreement with Colin's point here. If they all log in with the same >> login form, I'd store them in a single "users" table and have a "roles" >> field that would help authorize requests using something like "CanCan" . >> >> >> On 25 May 2013 12:10, Colin Law <clan...@googlemail.com> wrote: >>> >>> On 25 May 2013 03:55, Peter <pe...@poproj.com> wrote: >>> > Can I please get everyone's opinion? Should customers and admins be on >>> > separate tables? I'm developing an application that has two kinds of >>> > users, >>> > a customer and an administrator. >>> >>> You have given the game away here by describing them as 'kinds of >>> users'. Have one table and distinguish the users types with a >>> boolean, for example. I guess they will both have to login for >>> example, and that is much easier with one table. You could look at >>> the cancan gem to handle the roles but it may be simpler just to use >>> before_filters to control the access. >>> >>> > >>> > The application basically is a shopping cart. Customers from the >>> > internet >>> > create their accounts so they are able to buy my products. But there >>> > are >>> > also administrators (admins). Admins are my employees. They maybe call >>> > new >>> > customers and try to sell them my products. They have the ability to >>> > create, >>> > update and manage customers' accounts. Admins are able to buy products >>> > for >>> > customers upon their request. I hope that makes sense. >>> > >>> > Given that admins and customers have different roles but are the same >>> > objects, users, should they be in separate tables? Thank you. >>> > >>> > -- >>> > 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+unsubscr...@googlegroups.com. >>> > To post to this group, send email to rubyonrails-talk@googlegroups.com. >>> > To view this discussion on the web visit >>> > >>> > https://groups.google.com/d/msgid/rubyonrails-talk/5f95a7f7-1368-43f3-ac54-18b0dfa64dfb%40googlegroups.com?hl=en-US. >>> > 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+unsubscr...@googlegroups.com. >>> To post to this group, send email to rubyonrails-talk@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvJgAt_G5oc3zvB9gVVZ3KcvhH_tCAAK89gBWi9iaeztg%40mail.gmail.com?hl=en-US. >>> 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+unsubscr...@googlegroups.com. >> To post to this group, send email to rubyonrails-talk@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/rubyonrails-talk/CAJ%3Dox-C2OzpRqXH-nQJRZTkG79wakYmAnaJspp%2BJKenK2sDGYw%40mail.gmail.com?hl=en-US. >> >> 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+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/CANQThms2Dvj08LUju2HUCqvEPkbH6uZWXa_%3DHxz%2BjWPD4VuTkA%40mail.gmail.com?hl=en-US. > > 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+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvrg66QhHa%2Bn3Nyh29HuSQSOkax0L9iQJyJt0Bq6_8Ltw%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.