At the moment, I have this run of code:
<%=h current_user.notes.collect { |t| t.name }.join(', ') %>
which outputs this:
note 1, note 2, note 3
How can I change it so that the output looks like this?
"note 1", "note 2", "note 3"
Thanks for reading.
Edit: Here is the full code of KandadaBoggu's suggestion below
$(window).ready(function() {
$("input#note_name").autocomplete({
source: [<%=h escape_javascript(current_user.notes.collect { |t| '"%s"' % t.name }.join(', ')) %>]
});
});
And here is the output HTML:
$(window).ready(function() {
$("input#note_name").autocomplete({
source: [\"note 1\", \"note 2\"]
});
});