Tips and Tricks

Date, Time, and Time Zones

Infopark Rails Connector automatically converts date values originating from the CMS to the time zone currently active in the Rails application. To do this, it uses the Time Ruby class. The timezone active in the Rails application can be determined as follows:

$ rails console
Loading development environment (Rails 3.0.5)
>> Time.now.zone
=> "CET"

See also the Rails documentation on time zones at http://apidock.com/rails/ActiveSupport/TimeWithZone.

Accessing the API Documentation

The API documentation of the Rails Connector is generated by means of RDoc during the installation of the Rails Connector. To access the documentation the RDoc server needs to be started first:

gem server

Afterwards, you can read the documentation for all the installed gems by pointing a web browser to http://0.0.0.0:8808/. You can also access the same documentation by visiting Rubygems.org.

Running several Ruby versions on one system

When working on different projects or when updating a Rails application, it is often necessary to have different ruby versions installed on the system. For example, one version for an old Rails application and a more recent version for the updated application. In such cases, rbenv has proven to be a very useful tool. It lets you install different Ruby versions and the gems associated with them without requiring deep integration into the operating system. Switching between the versions is easy. To install rbenv, just check it out from GitHub, and slightly adapt your shell configuration.