5 posts in total


Posts tagged

HTTP headers in Rails

by Syed Aslam · 1 min read

Accessing the headers sent by clients in rails spits out both headers along with other environment variables. This adds a bit of inconvenience if you want to process only the external headers.

Dynamic Full Page Background Images in Rails

by Syed Aslam · 2 min read

Easy way to set a background from a selected number of images in Rails. You can set a background image purely through CSS thanks to the 'background-size' property in CSS3. Using the `html` element is better than `body` as it's always at least the height of the browser window. You set a fixed and centered background on it, then adjust it's size using `background-size` set to the cover keyword.

Adding close link to flash messages

by Syed Aslam · 1 min read

The flash provides a way to pass temporary objects between actions. Anything you place in the flash will be exposed to the very next action and then cleared out. Learn a way to add close buttons to flash messages in Rails templates.

Connecting to multiple databases in a Rails app

by Syed Aslam · 1 min read

A traditional Rails application uses a single application. We interact with it by writing models that inherit from `ActiveRecord::Base` which translate connection details (from config/database.yml) via the method `establish_connection`. Let's see how to connect to multiple databases from a Rails app.