1

RoR application can generate URL such as /post/10. But now I want to create a site, which works with URI-fragments like gmail.

For example gmail uses the following URLs https://mail.google.com/mail/?shva=1#sent https://mail.google.com/mail/?shva=1#label/books

I need to generate URL such as /#/post/10, where controller = "post", action = "show", id = "10".

Of course it will be good to use standard url-helpers.

Alexei
  • 231
  • 1
  • 2
  • 11

2 Answers2

2

According to this question everything after # is not sent to server. And if you want to handle something after # then you should use js (as @Gumbo said).

If you want to create complicated routes you can use route globbing - so this is the way to handle complicated url on server side. But if you want to generate urls you can write your own helpers. Url is nothing more than simple string.

Community
  • 1
  • 1
klew
  • 14,837
  • 7
  • 47
  • 59
1

The URI fragment is not sent to the server but only for local purpose. So you would need a client side language like JavaScript to parse the fragment and retrieve the resource.

Gumbo
  • 643,351
  • 109
  • 780
  • 844