在rails中呈现HTML文件

时间:2013-03-04 07:41:53

标签: ruby-on-rails-3

我正在使用CarrierWave将静态HTML模板上传到我网页上的某些用户个人资料。

我尝试在用户登录后在用户主页上呈现HTML文件。上传后HTML文件的路径为:

/uploads/profile/curation/8/User_Content.html

我是铁杆新手,我以为我能够

<%= render /uploads/profile/curation/8/User_Content.html %>

获取html进行渲染,但我想这只适用于partials,而不是。

有什么建议吗?

2 个答案:

答案 0 :(得分:0)

在您的控制器中,您可以重定向到所需的页面:

redirect_to "/uploads/profile/curation/8/User_Content.html"

答案 1 :(得分:0)

您可以使用render_to_string。请看看这里。 http://russbrooks.com/2009/11/18/embed-a-static-hmtl-page-in-a-rails-view