在浏览器中打开.html.erb文件 [英] Opening .html.erb files in browser

查看:258
本文介绍了在浏览器中打开.html.erb文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在浏览器中自行打开.html.erb文件。我尝试查看的Rails应用程序是在Rails 2.3中运行的,不会在Rails服务器上本地运行,也不会在我提供命令脚本/服务器时运行。

Is there a way to open .html.erb files by themselves in the browser. The Rails app I am trying to have a look at is in rails 2.3 and will not run locally on the rails server nor will it run when I give the command script/server.

我只想自己在浏览器中打开各个视图...这可能吗?

I would just like to open the individual views in the browser by themselves...is this possible?

推荐答案

在rails4中,您可以这样操作:

In rails4 you can do it like this:

erb a.html.erb > a.html

也许在Rails 2.3中不起作用。如果要渲染该视图,也许可以使用 users#index 之类的操作并更改代码以呈现它:

Maybe it doesn't work in rails 2.3. If you want to render that view, maybe you can use an action just like users#index and change the code to render it:

render "devise/mailer/a.html.erb", :layout => false

这篇关于在浏览器中打开.html.erb文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆