How to set Cache-Control and Expires headers for Paperclip uploads.

In Ruby on Rails applications, gem Paperclip is often used with gem Fog, which has a feature of setting up Cache-Control and Expires headers for file uploads. Assuming, there is the following configuration in config/application.rb file: config.paperclip_defaults = { storage: :fog, fog_credentials: { provider: "Local", local_root: "#{Rails.root}/public" }, fog_directory: "", fog_host: "localhost" } Cache-Control and Expires headers can be set up by adding related attributes to the paperclip configuration: [Read More]

How to fix problems when migrating a Rails app from MySQL to PostgreSQL

Recently, at eet.nu we have been working on migrating a Ruby on Rails application from MySQL to PostgreSQL. Depending on the complexity of an app, there might be many caveats during migration. Here are some notes on issues that we solved during the migration. This article assumes that we work with: Ruby on Rails 4; MySQL 5.6; PostgreSQL 9.4. Quoting and Boolean fields MySQL uses backticks (`) for quoting, while in PostgreSQL double quotes (“) are being used. [Read More]