0

I've been trying to set the timezone of a dashing.io app (which runs under sinatra) with no success at all!

Doing: Time.zone ends up with NoMethodError - undefined method 'zone=' for Time:Class:

I've tried the solution at How to set timezone in ActiveSupport's TimeZone class :

require 'active_support/all'

But then i get the error: require': cannot load such file -- active_support/all (LoadError)

Community
  • 1
  • 1
KoU_warch
  • 2,160
  • 1
  • 25
  • 46

1 Answers1

2

Active Support is not installed by default.

There are two stages of using third-party library's.

  1. Installation
  2. Registration

First things first, I assume that you follow the official guide on dashing.io.

stage 1 - Installation

With this in place you can add the gem activesupport which you need for this in to your Gemfile. Just adding a line like this:

gem 'activesupport'

After that you need to install it, you can do that with just running a second time bundle this fetch all gems and install it.

stage 2 - Registration

After you installed it, you can do what you tried with:

require 'active_support/all'

This tell that you load the active_support library.

THE END

After this two simple steps you can use Time.zone as expected.

Sir l33tname
  • 4,026
  • 6
  • 38
  • 49
  • I figure out to this eventually however it seems that i have no idea how to use the Time.zone thing. I placed it in the config.ru and when tried to use it in a view it would still give me the central time. I ended just just creating a variable in the view called time_adjustment and add it to all the times i want to use a time operation. – KoU_warch Aug 23 '14 at 13:35