On Sat, Oct 24, 2009 at 3:56 PM, Jake Boxer <jacob.bo...@gmail.com> wrote: > > After a lot of careful research, I've made the decision to go with > Authlogic ( http://github.com/binarylogic/authlogic ) for > authentication in my app. > > I currently have a User model (which "acts_as_authentic" in > Authlogic). However, my app is going to have multiple user types > ("Teacher", "Student", and potentially "Teacher's Assistant"). For the > moment, they'll all be mutually exclusive; a user can't be both a > Teacher's Assistant and a Student, for example. > > Currently, I'm planning on creating separate models for each of these > (Teacher, Student, TA). They'll each "belongs_to" a User, and a user > will "has_one" of each. This way, I'll be able to put any common > methods/fields in User, and any exclusive methods/fields in the model > it belongs in. > > I'm very new to Ruby (and, by association, to Rails). Does this sound > like a reasonable way to do this? Does it follow "the Ruby/Rails way"? > Or is there a common pattern for doing this in Rails that I don't know > about? >
In despite of a design problem, or the misconception on inheritance which Marnen already explained and you must change it if you haven't already, have you think about using a plugin for this? I've used acts_as_permissible[1] and it's really simple to use and configure, it has resolved the problem you're presenting here. [1]http://github.com/NoamB/acts_as_permissible/ Hope it helps. -- Leonardo Mateo. There's no place like ~ --~--~---------~--~----~------------~-------~--~----~ 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@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 -~----------~----~----~----~------~----~------~--~---