Erwin
2008-Feb-07 11:46 UTC
single inheritance 2 models OK, but what about the controller ?
Hey I am using a single inherance table : class User < ActiveRecord::Base class Member < User I would like to use only ONE controller accessing GET /members.xml should be equivalent to GET / users.xml should I have a member_controller and redirect all CRUDs to the equivalent action in users ? or is there any trick .. thanks erwin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ahmad
2008-Feb-07 12:46 UTC
Re: single inheritance 2 models OK, but what about the controller ?
I was about to ask the same question, and saw yours at the top. I have the same setup table: animals class Animal < ActiveRecord::Base end class Dog < Animal end class Cat < Animal end I just want to know how and pros and cons of using 1 controller / 1 view for each action, or a controller and set of views for each subclass. On Feb 7, 2:46 pm, Erwin <yves_duf...-ee4meeAH724@public.gmane.org> wrote:> Hey > > I am using a single inherance table : > > class User < ActiveRecord::Base > > class Member < User > > I would like to use only ONE controller > > accessing GET /members.xml should be equivalent to GET / > users.xml > > should I have a member_controller and redirect all CRUDs to the > equivalent action in users ? > > or is there any trick .. > > thanks > erwin--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2008-Feb-07 12:48 UTC
Re: single inheritance 2 models OK, but what about the controller ?
You should be able to define a new members_controller like this: class MembersController < UsersController; end It should get all the methods from UsersController. Not sure if it''ll do the routing though, but I think it''s worth a shot. On Feb 7, 2008 10:16 PM, Erwin <yves_dufour-ee4meeAH724@public.gmane.org> wrote:> > Hey > > I am using a single inherance table : > > class User < ActiveRecord::Base > > class Member < User > > I would like to use only ONE controller > > accessing GET /members.xml should be equivalent to GET / > users.xml > > should I have a member_controller and redirect all CRUDs to the > equivalent action in users ? > > or is there any trick .. > > thanks > erwin > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---