I'm surprised that Rails doesn't have a built-in way of doing this!
As Paul said, I can't think of why embedded json would be worse than
any other way of transmitting the data, especially for things like
backbone apps.

As I mentioned on 
http://stackoverflow.com/questions/7205902/how-to-safely-embed-json-in-html-document/
a workaround is:

<script type="text/javascript" charset="utf-8">
  //<![CDATA[
  var tags_list = <%=raw @tags.to_json.gsub('/', '\/') %>;
  // ]]>
</script>

but that's kind of ugly.  Again, I'm surprised there isn't a built-in
way of passing JSON data to from controller to view like this.  Am I
missing some obvious reason why?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to