Re: [Rails] Re: Can I do <%=.%> interpolation without getting a

tag?

if you change js_unhide_idstrings.join(',') to js_unhide_idstrings.join(',').html_safe that should decode the entities.


On Mon, Jul 7, 2014 at 10:50 AM, Ronald Fischer <lists@ruby-forum.com> wrote:
> If you just want to print out the bare text, you can just put that in
> your
> erb tag: <%= my_variable %>

This didn't work either, because the value of my_variable contains
simple quotes, and these had been replaced by an HTML entity denotation
(in this case, it is &#39;). That's why I thought I would need
simple_format (I was not aware that the <p> was coming from
simple_format .... I should have known this)

Maybe I post here my code in question:

<% js_unhide_idstrings=@sequence[1..-1].map {|n| "'tu_idiom_#{n}'"} %>
<script>
  ...
  var unhide_ids=[<%= js_unhide_idstrings.join(',') %>];
  ...
</script>

If @sequence is, say [4,1,9], the generated JavaScript code would be

var unhide_ids=[&#39;tu_idiom_1&#39;,&#39;tu_idiom_9&#39;];

--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9ba5efd6a29b4a24bb6fcc6b15bf30b1%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAAb4X%3DwJBk2TAvZWrTPnaYUwye2sf%2Bz1ot9221quDMeJNUvzeA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.