English 中文(简体)
铁路和标准摩擦
原标题:Ruby on Rails and standard mod_rewrite

我先用购买力平价书写一份旧的申请,现在我用新的RoR app取代。 旧的申请与“The-is-seo-title,n123.html”等链接。 上网时有一项规则是将这些链接与新闻相传。 php?id=123。

现在,当我设立RoR,链接是“RoR”式的(控制器/:行动/:id)。 它冷却和冰,但在谷歌一角,大约有50克指数的分页。 我不想拿到这个指数化的分页,所以现在的问题是:

Can 我在存取档案中制定新的规则,将翻译与新闻/新闻/123的链接“这一-is-seo-title,n123.html”?

我当时还没有部署,我没有能够使用乘客模块的环境,因此我可以自己测试。

问题回答

我并不认为必须使用 h门。 如果你正在铁路,那么就与铁路帮助者打交道。 我认为,这应当在你的道路上进行。 rb:

match  this-is-seo-title,n:id.html  =>  news#show 

这一路线将使用新闻主计长和显示行动123作为直截了当的参数。 你在什么地方寻求?

Edit:

铁路2

map.connect  this-is-seo-title,n:id.html , :controller =>  news , :action =>  show 

至少我认为,这将在铁路2区开展工作。 我没有任何环境可以起立,可以进行试验。 让我知道,它是否做了工作。





相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签