Based on the fact that hobo_model_controller takes a model name as an
argument, I assumed that if I created a Foo resource and then replaced
my FoosController with:
class BarsController < ApplicationController
hobo_model_controller Foo
auto_actions :all
end
That I would then have bar routes instead of foo routes. But it turns
out the routes are named after models. It seems very strange to me to
not name routes after controllers. Is there a reason for this?
I went ahead and redefined ModelRouter#plural to
"controller.controller_name" and ModelRouter#singular to
"controller.controller_name.singularize". Everything seems OK so far,
but I wanted to check and make sure it won't cause problems.
-david
I think this was a mistake, as you point out.
> I went ahead and redefined ModelRouter#plural to
> "controller.controller_name" and ModelRouter#singular to
> "controller.controller_name.singularize". Everything seems OK so far,
> but I wanted to check and make sure it won't cause problems.
Maybe we should make this change before 1.0
Comments?
Tom
I say aye.
-david
I don't completely understand HoboHelper#object_url, but I think it
also needs to be updated to get link href from controller or will be
broken.
-david
Oh yes of course. I was forgetting all about this side of things when
I said we should make this change. Hobo really does work on the
assumption that the routes for an object are based on its class name.
Fixing this for routing is quite easy, but is breaks object_url which
is used all over the place in the view layer.
That'll teach me to dash off a reply without thinking it through : )
Tom
The correct solution would probably be to make routing and URL
generation aware of view-hints.
Tom