在新主机上运行我的Rails应用程序并从1.9.3升级到Ruby v2.0.0,我收到了这个奇怪的语法错误。它看起来像这样:
Completed 500 Internal Server Error in 178ms
ActionView::Template::Error (/home/action/braindb/app/views/folders/_contents.html.erb:124: syntax error, unexpected keyword_ensure, expecting end-of-input):
121:
122: </script>
app/views/folders/show.js.erb:1:in ` _app_views_folders_show_js_erb__1073772573694008441_69985052296980'
app/controllers/folders_controller.rb:34:in `show'
我不确定我的<script>
代码有什么问题,所以我会在这里粘贴文件(_contents.html.erb):
<div id="panel-container">
<div id="entry-container" class="entry-window">
<div id="meta-bar" class="top">
<span id="location-span" style="position:relative; float:left;">In <%= @folder.title %></span>
<div id="entry-meta" class="meta-info">
<i class="icon-remove icons top-icons" id="close"></i>
<i class="icon-ok icons top-icons" id="save-entry"></i>
</div>
</div>
<div id="entry-create-partial" class="contain-entry">
<div id="title-create-partial" class="title-partial" name="title" contenteditable="true" data-placeholder='Title it' style="color:black"></div>
<div id="content-create-partial" class="content-partial" name="content" contenteditable="true" data-placeholder='Write anything' style="color:gray"></div>
</div>
</div>
<div id="right-panel" class="resize">
<div id="top" class="top">
<div id="folder-left">
<h3><%= @folder.title %></h3>
<% if @folder.children.count + @folder.submissions.count == 0 %>
Empty! Add journals & entries
<% else %>
<%= @folder.children.count %> Journals & <%= @folder.submissions.count %> Entries
<% end %>
</div>
<% end %>
<ul id="inner-list">
<button class="btn" id="journal-create-button">New Journal</button>
<div id="create-journal-drop">
<form action="/folders" method="post">
<%= hidden_field_tag :user_id, current_user.id %>
<%= hidden_field_tag :parent_id, @folder.id %>
<h3 id="journal-create-partial">New Sub-Journal</h3>
<input type="text" id="titleinput" name="title" placeholder="Title it">
<button type="submit" class="md-close folder-create" id="folder-create">Create</button>
</form>
</div>
<button class="btn" id="entry-button">New Entry</button>
</ul>
</div>
<% if @folder.submissions.count > 0 %>
<svg id="submission-circles">
<circle></circle>
<circle></circle>
<circle></circle>
<circle></circle>
</svg>
<% else %>
<h2>It's quiet in here. Create a journal entry or sub-journal to get started!</h2>
<% end %>
</div>
<script type="text/javascript">
d3JSON = function(){
d3.json("/folders/<%= @folder.id %>.json", function(error, data) {
var circle;
var svg = d3.select("body").selectAll("svg");
circle = svg.selectAll("circle")
.data(data.submissions, Array);
circle.enter().append("svg:a")
.attr("xlink:href", function(d){
return "#";
})
.append("circle")
.style("fill", "#c0392b")
.attr("id", function(d){ return d.id; })
.attr("data-name", function(d){ return d.title; })
.on("click", function(d) {
if (d.children !== null) {
console.log(d.children);
$.get("/parent_submissions/", {submission: d.id}, null, "script");
}else{
$.get("/new_submission/", {submission: d.id}, null, "script");
}
})
.attr("cy", 90)
.attr("class", "floating")
.attr("cx", function(d){
return (d.content.length / 2) * 10 + "px";
})
.attr("r", 50);
$("svg circle").tipsy({
gravity: 'w',
html: true,
title: function() {
var d = $(this).closest("svg circle").attr("data-name");
return d;
}
});
circle.exit().remove();
});
};
entryAJAX = function(){
$("#save-entry").click(function(){
$.ajax({
type: "POST",
url: "/submissions",
dataType: "json",
data: {title: $("#title-create-partial").text(), content: $("#content-create-partial").text(), folder_id: <%= @folder.id %>},
complete: function(){
$.get("/ajax_load_events/", {folder: <%= @folder.id %>}, null, "script");
}
});
});
};
</script>
现在这些Javascripts位于我的_contents.html.erb文件的底部。
答案 0 :(得分:0)
在关闭de div#folder-left
之后和ul#inner-list
之前,你有一个<% end %>
,但我找不到一个阻止他开始......
我错过了什么或者你错过了什么?