Ruby json gem编码html实体
我在我的代码中创建了一个名为timeOffsets的哈希
@timeOffsets = Hash.new total=0 @sections.each do |i| @timeOffsets[i.shortcode] = total total+=i.length end
我使用to_json在Javascript中渲染它,:
timeOffsets=;
但我用编码的HTML实体得到它:
timeOffsets={"Introduction_to_Lists":0,"Removing_elements":693,"Joining__join_":1490};
如何阻止它编码HTML实体?
timeOffsets=<%=raw @timeOffsets.to_json%>
使用原始视图助手。