I would like to create a web application that has two types of users, producer and consumer. Both users have three fields in common : username,password and email. Producer has also the fields address and telephone. I could make separate models,views,controller and tables for each user types but this violates DRY. Could Single table inheritance be used and how? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/xSVB5GrNrEMJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 25 March 2012 09:52, pavlos kallis <pakallis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I would like to create a web application that has two types of users, > producer and consumer. > Both users have three fields in common : username,password and email. > Producer has also the fields address and telephone. > I could make separate models,views,controller and tables for each user types > but this violates DRY. Could Single table inheritance be used and how?I would probably keep it simple and have a users table with all the fields in (leave the ones you don''t need empty) and use the cancan gem to give the different types of users different roles. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Interested to know which direction you went in since I''m working on this issue now. thanks. On Sunday, March 25, 2012 4:52:10 AM UTC-4, pavlos kallis wrote:> > I would like to create a web application that has two types of users, > producer and consumer. > Both users have three fields in common : username,password and email. > Producer has also the fields address and telephone. > I could make separate models,views,controller and tables for each user > types but this violates DRY. Could Single table inheritance be used and how? >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/36k8UPTuMWEJ. For more options, visit https://groups.google.com/groups/opt_out.