html +导轨问题

发布于 2024-10-08 12:55:11 字数 303 浏览 0 评论 0原文

我可以在 html 页面中添加 ruby​​/rails 代码吗?我的要求是,在我的 html 页面中显示一部分

这是否可能,如果可以,请告诉我如何做。

我当前的代码是:

index.html:

<%= render :partial => <partial>%>

所以我在这里尝试做的是将部分渲染到我的html页面。

我在 ubuntu 上使用 Rails 3。

提前致谢。

干杯, 萨梅拉

Can I add ruby/ rails code inside an html page. My requirement is, get a partial to display in my html page

Is this possible and if yes please show me how.

My current code is:

index.html:

<%= render :partial => <partial>%>

So what I'm trying to do here is have the partial rendered to my html page.

I'm using rails 3 on ubuntu.

Thanks in advance.

Cheers,
sameera

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

呆萌少年 2024-10-15 12:55:11

您可以像这样渲染部分:

<%= render :partial => 'name_of_partial', :locals => { :some_variable_to_pass_to_partial => "abcd" } %>

这里有一些关于Rails 中的布局和视图的好信息。

You can render partial like this:

<%= render :partial => 'name_of_partial', :locals => { :some_variable_to_pass_to_partial => "abcd" } %>

Here is some good information about layouts and views in Rails.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文