I’m working on building an administration (cms) system for websites that
I manage. I’m trying my best to stick to the RESTful concepts, so right
now I have my controllers structured like this:
I’ve heard a lot of bad things about modules, but it seems like most of
the problems come down to naming conflicts when you’re dealing with
namespaced models. I much prefer the module approach because it keeps
everything separated and organized…what do you guys think?
There is an excellent discusison on namespaces in AWDwR book. You will
basically have two different directories containing the same class
name but the namespace will be distinguised by using the :: operator.
I’ve heard a lot of bad things about modules, but it seems like most of
the problems come down to naming conflicts when you’re dealing with
namespaced models.
It’s all FUD. I haven’t experienced any problems using controller
modules. I’m not sure what “namespaced models” are.
I’ve heard a lot of bad things about modules, but it seems like most of
the problems come down to naming conflicts when you’re dealing with
namespaced models.
It’s all FUD. I haven’t experienced any problems using controller
modules. I’m not sure what “namespaced models” are.
Joe
It is what it is. In my experience, a number of plugins, especially but
by no means only ones involved in authentication and authorization, have
problems with namespaced controllers. One of my early apps was built
with controller modules for Admin::* operations, but the time spent
dealing with the problems eventually became enough of an annoyance that
I got rid of the hierarchy and flattened out my controllerspace. Getting
work done is more imporant to me than a fixation on Code Esthetics, and
if I really had that many admin controllers I wanted to segregate, I
suppose I could prefix them and their corresponding helpers and view
directories with “admin_”.
I’ve heard a lot of bad things about modules, but it seems like most of
the problems come down to naming conflicts when you’re dealing with
namespaced models.
It’s all FUD. I haven’t experienced any problems using controller
modules. I’m not sure what “namespaced models” are.
Joe
I actually did some playing with namespaced controllers (modules) last
night and ended up running into some problems after-all…so I think I’m
going to stay away from the whole concept. I prefer REST over RPC, and
there are some big compatibility problems with the simply_restful
support in edge rails and namespaces. I figure I’ll just stick with
using before_filters on specific actions as opposed to separating
everything out.
It is what it is. In my experience, a number of plugins, especially but
by no means only ones involved in authentication and authorization, have
problems with namespaced controllers. One of my early apps was built
with controller modules for Admin::* operations, but the time spent
dealing with the problems eventually became enough of an annoyance that
I got rid of the hierarchy and flattened out my controllerspace. Getting
work done is more imporant to me than a fixation on Code Esthetics, and
if I really had that many admin controllers I wanted to segregate, I
suppose I could prefix them and their corresponding helpers and view
directories with “admin_”.
YMMV.
Hmm, yeah, I guess if I had some plugins I couldn’t live without (which
I don’t – I’ve checked out all the member/user plugins and didn’t like
any of them). But then I’d say the plugin author is to blame for not
working with namespaced controllers, and maybe I’d even also try to get
it to work with namespaced controllers. I just looove how namespaced
controllers keep individual files simple.
I’ve heard a lot of bad things about modules, but it seems like most of
the problems come down to naming conflicts when you’re dealing with
namespaced models.
It’s all FUD. I haven’t experienced any problems using controller
modules. I’m not sure what “namespaced models” are.
Joe
I actually did some playing with namespaced controllers (modules) last
night and ended up running into some problems after-all…so I think I’m
going to stay away from the whole concept. I prefer REST over RPC, and
there are some big compatibility problems with the simply_restful
support in edge rails and namespaces. I figure I’ll just stick with
using before_filters on specific actions as opposed to separating
everything out.
Andrew
I’m curious – what problems specifically? I haven’t really messed
around with web services yet. If there are conflicts with controller
namespaces, I’m sure Rails core would like to hear about them (i.e.
tickets).
I’ve heard a lot of bad things about modules, but it seems like most of
the problems come down to naming conflicts when you’re dealing with
namespaced models.
It’s all FUD. I haven’t experienced any problems using controller
modules. I’m not sure what “namespaced models” are.
Joe
I actually did some playing with namespaced controllers (modules) last
night and ended up running into some problems after-all…so I think I’m
going to stay away from the whole concept. I prefer REST over RPC, and
there are some big compatibility problems with the simply_restful
support in edge rails and namespaces. I figure I’ll just stick with
using before_filters on specific actions as opposed to separating
everything out.
Andrew
I’m curious – what problems specifically? I haven’t really messed
around with web services yet. If there are conflicts with controller
namespaces, I’m sure Rails core would like to hear about them (i.e.
tickets).
Joe
The main thing that was annoying me is that the named routes that
simply_restful generates were acting strange…I’ll have to test it out
again tomorrow to replicate the problem - I don’t recall exactly what
the error was. It may have been something I did wrong, but all I did
was move my controllers into an admin::* namespace and set the resource
path_prefix to ‘/admin’, which seemed like the logical thing to do.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.