I am trying to design an interface that handles user accounts and their email aliases. What is the relationship between a user and their email accounts? -Ron --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
It depends (I know -- great answer). Do you intend to allow only one e-mail address per user? If so the email should just be an attribute of your user model (an email column in the users table). If you want to allow more than one you could be lazy and just add columns for email1, email2, and email3. You could also have a User model and an Email model where User has_many :emails and Email belongs_to :user. The emails table would be pretty simple -- just columns for id and email. In your controllers you could then use the methods that Rails sets up for you automatically like: u = User.find(1) u.emails On Jul 27, 12:33 pm, Ronald Valente <rawn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am trying to design an interface that handles user accounts and their > email aliases. > > What is the relationship between a user and their email accounts? > > -Ron--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
sorry i misunderstand does the email aliases is equal to email address --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
gene.tani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jul-27 19:04 UTC
Re: When to use Has Many and Has and Belongs to many.
On Jul 27, 10:33 am, Ronald Valente <rawn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am trying to design an interface that handles user accounts and their > email aliases. > > What is the relationship between a user and their email accounts? > > -Ronthis from Apr, 2006, still good orientation material http://blog.hasmanythrough.com/2006/04/20/many-to-many-dance-off --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---