Craig W. wrote:
On Sun, 2010-03-07 at 04:57 +0100, Phillip K. wrote:
picked it up. However, for reasons I don’t want to go into detail about,
work?
assuming that the first line of
app/controllers/web/utility_controller.rb looks like
class Web::UtilityController < ApplicationController
No, it’s actually
class Web::UtilityController < Web::BaseController
where
class Web::BaseController < ApplicationController
I don’t think you really need to do a whole lot with routes.rb at all
I didn’t think so either. That’s why I was surprised when the default
route of
map.connect ':controller/:action/:id
didn’t work. But since I’m not passing an id to this action, I even
tried
map.connect ':controller/:action
but that didn’t work either.
(the views would necessarily have to follow a similar pathing in
app/views/web/utility)
Right. I got all that taken care of. I’ve had success in the past using
namespaced controllers, but this is the first time I have done so with
one that wasn’t a resource. I’ve never had any difficulty when I have
done this something like this in routes:
map.namespace :web do |web|
web.resources :pages
end
I don’t really want to resource this utility controller as it is just
for actions that do little odds and ends that need to be done, but don’t
really belong anywhere else. The particular case in question is storing
the current state of an expandable menu structure. As the user navigates
from page to page, I restore the menu to the “current” state so the user
doesn’t have to keep expanding things over and over. It’s stored in the
session, not the database, so I didn’t want to put it on the People
(user) controller.
but I also wonder whether you are using the
plural utilities instead of the singular utility, etc.
No, just singular. Since it’s not a resource, it makes more sense to me
to have it singular. Much like HomeController.
Thanks for your input!
Peace.