Hey,
On 28-Dec-06, at 10:57 AM, Rick Olson wrote:
You know what, I'm going to comment in whatever order I please.... so
here we go...
without *any* code changes (unless you had ActiveResource clients, in
which case you'd have to change the name of your param for the
resource entity in your controllers etc - a small change compared to
the current alternatives).
Changing your own code involves a quick search/replace. Changing
client code requires API breakage or deprecation. I'd rather have to
change my own code.
Absolutely - I too would rather change my own code... I just want to
change less of it than I have to now. Unfortunately we're discussing
hypothetical API changes - entirely my fault, I brought it up :-P
So there's hypothetical changes which would be made easier
by :opaque_name (less search-and-replace) and others, perhaps more
far-reaching, where it wouldn't make a blind bit of difference. The
only concrete example I've got is the one I've given which you've
correctly pointed out can be achieved without :opaque_name, albeit
with a bit more effort.
Scroll down, there's more :-)
However, map.resources is currently tightly coupling the interface
(the URL elements) to the guts of my code and I want a more painless
way to exert control over that. With this one-line change to
resources.rb I can divorce the resource name in my code from the
resource name in the URL.
I see your point in keeping the resource route that matches the
resource/model name. I'm thinking something a little more clear than
opaque_name would work better though:
map.resources :quotes,
:controller => 'quote_requests',
:named_route => 'quote_requests'
There's two reasons I avoided approaching from this direction:
1 - At first glance it would require more changes to resources.rb -
all usage of resource.singular and resource.plural in the
map_X_actions methods would need checks for :named_route being
present - or (more correctly) some refactoring would need to be
applied. But my laziness helped me realize point #2:
2 - I view map.resources' first argument as the name of the resource
as *I* know it. The name of the resource as *clients* know it can be
altered using :opaque_name, vaguely analogous to ARes'
collection_name attribute. So I want to say "map my resource called
X and by the way, clients know it as Y". As such, your :named_route
argument is not the same thing.
That said, if the argument name of :opaque_name is the major
stumbling block I'll gladly change it to something more palatable -
perhaps :resource_url_name or similar.
And thanks for taking the time to hash this out :-)
Trev
--
Rick Olson
http://weblog.techno-weenie.net
http://mephistoblog.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on
Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---