I'm currently trying to get an example of the Chartkick gem to work in Ruby with Sinatra but I'm running into an issue. The example loads on my localhost but only shows "Loading..." and when I dug deeper I found this error in the console saying: "The resource from “http://localhost:4567/chartkick.js” was blocked due to MIME type mismatch (X-Content-Type-Options: nosniff)." Here is the example I'm trying to use:
require 'sinatra'
require 'chartkick'
get '/' do
erb :index
end
__END__
@@ layout
<html>
<head>
<script>
var Chartkick = {"language": "es"};
</script>
<script src="http://www.google.com/jsapi"></script>
<script src="chartkick.js"></script>
</head>
<body>
<%= yield %>
</body>
</html>
@@ index
<%= timeline [
["Washington", "1789-04-29", "1797-03-03"],
["Adams", "1797-03-03", "1801-03-03"],
["Jefferson", "1801-03-03", "1809-03-03"]
] %>]
I have tried setting the content type to various MIME combinations but it doesn't seem to work. I feel like I'm missing something that could be in the configuration for Sinatra or a small line of code for my browser to refuse loading that resource.