Routing Users to single Models with Rails

Posted by Eric Koslow on Stack Overflow See other posts from Stack Overflow or by Eric Koslow
Published on 2010-03-20T06:51:57Z Indexed on 2010/03/20 7:01 UTC
Read the original article Hit count: 469

I'm creating a Rails app for students and high schools and I'm having some trouble with my User.rb.

I want to have a user model to be used for logging in, but having that user have many roles. The tricky part is that I want users that have a student role to have_one student page, and those that have a role of principal to have_one high_school page.

The students and also nested in the high_school so the entire thing becomes a big mess.

So my question(s): How do I limit a user to only creating one student / high school to represent them? Also how would I nest this student pages inside the highschool without screwing up the user system?

My environment: Rails3 and Ruby 1.9.2dev

Thank you!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby