0

I have an array @gtaglist created with Ruby that has been converted to a JSON object using @gtaglist.to_json giving

{"id":28,"name":"Rome Catacombs Tour"},{"id":31,"name":"Baroque Churches Tour"},{"id":27,"name":"Borghese Gallery Tour"}

I am substituting the value of the Ruby JSON object i.e #{@gtaglist} into a string in a Javascript tag statement and obtaining the following

gtag('event', 'view_item_list', {
    "items": {"id":28,"name":"Rome Catacombs Tour"},{"id":31,"name":"Baroque Churches Tour"},{"id":36,"name":"Sts Peter & Paul Tour"}
    });

How do I replace the " with "

Using Ruby 2.4.3, Sinatra and Slim

arnoldtm
  • 77
  • 12

1 Answers1

0

Answer by @rael-gugelmin-cunha on ruby inside javascript block [slim template]

Use double curly braces i.e #{{@gtaglist}} instead of #{@gtaglist}

arnoldtm
  • 77
  • 12