Categories and admin/categories - different controllers and

Is there some way to have these two sets of URLs use
totally different controllers and templates?

categories/list
categories/show/1

admin/categories/list
admin/categories/edit/1
admin/categories/destroy/1
admin/categories/update/1

Besides, of course, using different controller names
;). The first URL is publicly accessible, while the
second contains admin functions. Also, with the
second, subclassing the Category controller from the
Admin controller makes it inherit its class functions
(like before_filters, layout, etc.), simplifying
itself and the other children admin controllers quite
a bit.

Right now, I have a Category controller with many
before_filter only/except clauses, and render
:layout=>‘public’|‘admin’ in many functions. And I
have several other contollers - yuck. I thought about
putting everything in one big monolithic admin
controller (list_categories, edit_category,
destroy_category, list_members, list_links, etc.).

Thanks for any thoughts!
csn


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around

I found this:

Controller Inheritance in Rails
http://justinfrench.com/index.php?id=122

Just about what I need, but there are three issues I
have:

  • Would want the base admin controller to be named
    admin_controller.rb or admin/admin_controller.rb
  • How to define an index method for /admin ?
  • I’ve never seen mention of this voodoo in the
    official docs, so maybe it’s unsupported and might
    break in future versions?

csn

— CSN [email protected] wrote:

csn
http://lists.rubyonrails.org/mailman/listinfo/rails


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around

Thought of another way:

routes.rb: map.admin_list ‘admin/list/:view’,

:controller=>‘admin’, :action=>‘list’ # or
‘admin/:view/list’

admin controller:

def list
case params[:view]
when ‘categories’
render :template=>‘admin/list_categories’
when ‘items’

when ‘links’
when ‘members’
when ‘pages’
end
end

Pretty simple.

csn

— CSN [email protected] wrote:

  • How to define an index method for /admin ?
    use

Besides, of course, using different controller
quite

Rails mailing list
http://mail.yahoo.com


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around