Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将 olark 添加到我网站上的每个页面,所以我将代码粘贴到我的共享文件夹中的一个部分中。
如何轻松地将其添加到每个页面?我注意到每页都包含一个页脚部分,我可以以某种方式将它与它联系起来吗?
您可以包含此部分内部application.html.erb布局文件<%= render 'partial_folder/partial_name' %>
application.html.erb
<%= render 'partial_folder/partial_name' %>
我在部分中使用了 olark scipt_olark.html.erb并包含在_footer.html.erb
_olark.html.erb
_footer.html.erb
您可以将此部分的渲染器添加到您的应用程序布局中views/layouts/application.html.erb
views/layouts/application.html.erb