[Nitro] Arbitrary length URIs

Jonathan Buch john at oxyliquit.de
Tue Jun 6 12:08:27 EDT 2006


Hi,

>>> def index(*fpath)
>>> end
>>
>> Which is almost the right way to do it :)
>>
>> def show(*fpath)
>> end
>
> What's the difference?

The difference being (like you note later in this post) that

/repository/ is the same as /repository/index

>> should be used (like your url below) because mapping *fpath to index
>> isn't going to work if you have a url like:
>> /repository/dir_1/ etc (because it will look for a method called
>> `dir_1` in the controller.
>
> My urls aren't like..
> http://myssite.com/repository/dir_1/dir_2/dir_n
> I have the action, 'index', in the url.
> http://myssite.com/repository/index/dir_1/dir_2/dir_n

I think I got confused by your last url, which is:
http://myssite.com/repository/show/dir_1/dir_2/dir_n/file.txt
(note the /show/ here), and my assumption that you maybe didn't know
about that the index method gets mapped to /repository/.

> I had assumed that http://myssite.com/repository/ and
> http://myssite.com/repository/index both call the index method of
> RepositoryController?

This is correct, yes.

Kashia

-- 
Feel the love
http://pinkjuice.com/pics/ruby.png



More information about the Nitro-general mailing list