【发布时间】:2013-03-01 14:15:47
【问题描述】:
我正在检查小项目的水星编辑器https://github.com/jejacks0n/mercury。
这是我的 routes.rb 文件
Myapp::Application.routes.draw do
mount Mercury::Engine => '/'
scope '(:locale)' do
resources :post
end
end
我的帖子网址是:
http://localhost:3000/es/posts/1
http://localhost:3000/en/posts/2
http://localhost:3000/de/posts/3
.
.
.
我的水星路线:
Routes for Mercury::Engine:
mercury_editor /editor(/*requested_uri)(.:format) mercury#edit
/mercury/:type/:resource(.:format) mercury#resource
/mercury/snippets/:name/options(.:format) mercury#snippet_options
/mercury/snippets/:name/preview(.:format) mercury#snippet_preview
我正在尝试类似的东西:
<%= link_to 'Edit', "/editor" + request.path %>
但我得到一个错误的网址http://localhost:3000/editor/es/posts/2。
有人能告诉我如何为我的路线添加指定路径,例如:
http://localhost:3000/es/editor/posts/1 或 http://localhost:3000/editor/posts/1
【问题讨论】:
-
“我的网址错误”是什么意思?这个网址是否有效,但您不喜欢它的外观?还是网址根本不起作用?对于它的价值,我刚刚经历过和你一样的情况,最终做了你所做的事情。使用该网址
http://localhost:3000/editor/es/posts/2一切正常
标签: jquery ruby-on-rails ruby-on-rails-3 mercury-editor