alias url with sinatra / padrino

让人想犯罪 __ 提交于 2019-12-05 04:57:30

问题


I've this and it works

  get :about, :map => '/about_us' do
    render :erb, "<%= 'foo' %>"
  end
  get '/:slug' do
    redirect "/about_us" # <--
  end

Is possible to do in some way "render" instead of "redirect"? or something like render 'posts/1'


回答1:


get :about, :map => '/about_us' do
  render :erb, "<%= 'foo' %>"
end

get '/:slug' do
  call env.merge('PATH_INFO' => '/about_us')
end


来源:https://stackoverflow.com/questions/3384134/alias-url-with-sinatra-padrino

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!