I render a partial via ajax in rails. Works great locally, but on heroku I get a 304 and nothing happens on the webpage : http://www.cremers.fr/articles/histoire
I first render all articles like so:
all_finance.html.erb
:
<%= render 'articles' %>
then in the partial _articles.html.erb
:
<% @articles.each do |a| %>
<% if a.categorie == "histoire" %>
<%= link_to "lire la suite", article_histoire_url(a.id), remote: true %>
<% elsif a.categorie == "finance" %>
<%= link_to "lire la suite", article_finance_url(a.id), remote: true %>
<% end %>
<% end %>
article_finance_url processes the action article#finance
. finance.js.erb
contains:
document.getElementById('trunc_article_<%= @article.id %>').remove();
document.getElementById('add_article_<%= @article.id %>').innerHTML = '<%= render("contenu") %>';
document.getElementById('add_link_<%= @article.id %>').innerHTML = '<%= link_to image_tag("partage.png", size: "20x20", class: "marge_ht"), article_finance_url(@article.id) %>';
finance.html.erb
contains:
<%= render 'article' %>
Running this locally works fine. On heroku, the server responds the right content, ie finance.js.erb
correctly rendered with the inbedded templates, but also give a 304 response.
为了后代:在我的情况下,我省略了关闭js文件的paranthesis。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.