Hello All, A bit of background. I have an EventGroups controller with new/create which are available to the general public and the rest of the CRUD actions are available to the Admin::EventGroups controller. Because of the split, I also have EventGroupsBase controller which holds autocomplete_index as both new and edit use it. EventGroupsBaseController < ApplicationController def autocomplete_index EventGroupsController < EventGroupsBaseController def new/create Admin::EventGroupsController < EventGroupsBaseController def index/show/edit/update/destroy No problem. But in my JQuery, I now have a condition in my autocomplete, testing if it''s a new form or an edit form. A new form calls /event_groups/autocomplete_index and the edit form calls /admin/event_groups/autocomplete. Ugly!! So I was wondering where is the best place to put that common method. There are no special privileges for Admin over the general public so it doesn''t seem right having two routes for it. Any advice would be great. Thanks -ants -- 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.
I think I''ll answer my own question. I''ll use a mixin. On 5 April 2011 20:04, Ants Pants <antsmailinglist-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello All, > > A bit of background. I have an EventGroups controller with new/create which > are available to the general public and the rest of the CRUD actions are > available to the Admin::EventGroups controller. Because of the split, I also > have EventGroupsBase controller which holds autocomplete_index as both new > and edit use it. > > EventGroupsBaseController < ApplicationController > def autocomplete_index > > EventGroupsController < EventGroupsBaseController > def new/create > > Admin::EventGroupsController < EventGroupsBaseController > def index/show/edit/update/destroy > > > No problem. But in my JQuery, I now have a condition in my autocomplete, > testing if it''s a new form or an edit form. A new form calls > /event_groups/autocomplete_index and the edit form calls > /admin/event_groups/autocomplete. Ugly!! > > So I was wondering where is the best place to put that common method. There > are no special privileges for Admin over the general public so it doesn''t > seem right having two routes for it. > > Any advice would be great. Thanks > > -ants > > >-- 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.
Ignore all of these mails. It''s late, I should''ve stopped working 4 hours ago. I really wasn''t thinking straight. It''s all sorted now. On 5 April 2011 21:25, Ants Pants <antsmailinglist-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I think I''ll answer my own question. I''ll use a mixin. > > > On 5 April 2011 20:04, Ants Pants <antsmailinglist-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> Hello All, >> >> A bit of background. I have an EventGroups controller with new/create >> which are available to the general public and the rest of the CRUD actions >> are available to the Admin::EventGroups controller. Because of the split, I >> also have EventGroupsBase controller which holds autocomplete_index as both >> new and edit use it. >> >> EventGroupsBaseController < ApplicationController >> def autocomplete_index >> >> EventGroupsController < EventGroupsBaseController >> def new/create >> >> Admin::EventGroupsController < EventGroupsBaseController >> def index/show/edit/update/destroy >> >> >> No problem. But in my JQuery, I now have a condition in my autocomplete, >> testing if it''s a new form or an edit form. A new form calls >> /event_groups/autocomplete_index and the edit form calls >> /admin/event_groups/autocomplete. Ugly!! >> >> So I was wondering where is the best place to put that common method. >> There are no special privileges for Admin over the general public so it >> doesn''t seem right having two routes for it. >> >> Any advice would be great. Thanks >> >> -ants >> >> >> >-- 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.