Sunday 8 November 2015

Ruby, Windows and Timezones

With the current builds of Ruby on Rails, there are a couple of problems with a default installation.

The first is that Windows environments seem to need the timezone data gem including.

The second is to do with the initial layout file.

Timezone data

If you have a Rails folder already, you might just be able to get away with the following:

Details about the timezone gem are in github. Add the following line to your Gemfile:

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

then run 
bundle update

as usual when you change your Gemfile.

To build a new Rails project

Follow Fletcher Nichols' instructions, (basically running this gist, then adding a new environment variable SSL_CERT_FILE with the value C:\RailsInstaller\cacert.pem.

application.html.erb

The line:
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
is currently failing on Windows environments. Replace the line with:
<%= javascript_include_tag 'default', 'data-turbolinks-track' => true %>

Adding the coffee-script-source gem to your the Gemfile seems fix the issue:
..
gem 'coffee-script-source', '1.8.0', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
seems to fix the issue.


Edit: added the coffee-script-source notes.
Edit2: Added the SSL_CERT_FILE notes