本文介绍了“ /#action” Ruby on Rails中的Routes.rb中的路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建这种格式的路由(在Ruby on Rails的route.rb文件中):

How can I create a route of this format (in Ruby on Rails routes.rb file):

/#action/id

特别是在动作控制器之前插入了#字符...例如,请参见

Specifically with the "#" character inserted before the action controller...for example, see http://lala.com/#album/some-album-id

谢谢!

推荐答案

您要访问的实际URL是 http://lala.com/ 。服务器看不到#album / some-album-id 件,。

The actual URL you are visiting there is http://lala.com/. The server does not see the #album/some-album-id piece, the fragment identifier. That is seen solely by the browser.

使用客户端/浏览器而非服务器上的视图和控制器来构建MVC应用的趋势正在增长。该应用程序是在客户端使用JavaScript而不是在服务器上使用Ruby来实现的。服务器实际上是API或数据访问层,而不是呈现HTML的部分。

There is a growing trend of building MVC apps with the views and controllers in the client/browser, rather than on the server. The application is implemented with JavaScript in the client, instead of with Ruby on the server. The server essentially becomes the API or the data-access layer, rather than being the piece that renders HTML.

这篇关于“ /#action” Ruby on Rails中的Routes.rb中的路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 15:05