On Mar 2, 2007, at 2:47 PM, Bertrand Mansion wrote:
> Le 2 mars 07 à 19:18, James Stewart a écrit :
>> On Mar 2, 2007, at 1:02 PM, Bertrand Mansion
wrote:
>>> In Rails and ZF and others, the router object
is indeed routing:
>>> it takes the url and automatically deduces a
'controller' and an
>>> 'action', even if they were not defined in the
url, then perform
>>> the action within the controller. While this is
handy if you have
>>> a framework that was made to work this way,
it's not very
>>> flexible because there is a lot more you can do
with an url than
>>> just routing like this. Furthermore, in such
frameworks, AFAIK
>>> (but I might be wrong), you always end up with
urls like these:
>>> http:
//example.com/controller/action/arguments. This is also
a
>>> limitation IMO.
>>
>> I've not used ZF, but that's not the case in rails.
The default
>> route is
>>
>> map.connect ':controller/:action/:id'
>>
>> but that can be removed or replaced with a wide
variety of other
>> options. eg. One I often use in location-driven
sites is:
>>
>> map.connect 'zip/:id' , :controller =>
'locations', :action => 'zip'
> ^^^
> Just a question here, what is this map object ?
In rails, that statement would be in your config/routes.rb
file and
would come inside a block, so the full declaration would
be:
ActionController::Routing::Routes.draw do |map|
map.connect 'zip/:id' , :controller => 'locations',
:action => 'zip'
# Declare any other routes in here too
end
James.
--
James Stewart
Play: http://james.ant
hropiccollective.org
Work: http://jystewart.net/pr
ocess/
|