Im currently trying to generate diagrams with a js lib and rails. It
doesn't work, though, since I can't figure out how to embed ruby code to
supply the diagrams with data. My editor highlights the ruby code
too, with I take as a hint for wrong ruby syntax.
The diagrams work if I use the pure-js sample data, but it REALLY dont
want to input data sets with 200 items by hand.
The snippet in question is this one, it lives in an .html.erb file:
var hour = [
<% @raw.each do |raw| %>
[ <%= if raw.status == "aufgewacht" %>
<%= Time.parse(raw.timestamp).wday.to_json %>,
<%= raw.timestamp[15,2].to_json %>
<% end %> ],
<% end %>
(yeah, pretty ugly)
Some error messages; line 20 contains the "if"-conditional
.../app/views/processed_data/_scatter.html.erb:20: syntax error,
unexpected ')', expecting keyword_then or ';' or '\n'
...nd= ( if raw.status == "woke" );@output_buffer.safe_concat('
app/views/processed_data/_scatter.html.erb:23: syntax error, unexpected
keyword_end, expecting ')'
...ffer.safe_concat(' '); end ;@output_buffer.safe_concat(...
Does anyone know how to do this?
Posted via http://www.ruby-forum.com/.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
To post to this group, send email to email@example.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0f8c516c5d0136e350659aa7ea4fba63%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.