I'm interested in learning in Rails 3, how to grab the URL with something like params[:urlpath]
and then indexing it with /
so if I had a url like examples:
/books/1
/books/1/authors/3
/books/1/authors/3/chapters
/books/1/authors/3/chapters/33
I could always obtain 1
something like params[:urlpath] index[2]
I need this to populate the following which is happening on the page:
$.ajax({
url: '/nav/sidenav',
data: "urlpath=" + urlpath
});
ideas? thxs