I think I'll answer my own question. I'll use a mixin. On 5 April 2011 20:04, Ants Pants <antsmailingl...@gmail.com> 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.