Archive | Rails

23 November 2007 ~ 1 Comment

Disabeling sessions in Rails

The simplest way to disable sessions in Rails is to use session ff (see ActionController::SessionManagement::ClassMethods). session ff To disable session suport only for a specific controller add session ff to that controller class MyController < ApplicationController session ff end Written like that, sessions are disabled for all actions on this controller. Like filters, you can [...]

Continue Reading

22 August 2007 ~ 0 Comments

Determining the number of days in a month

Here is a simple method that returns number of days for wanted month and year. If year is ommited current year is selected. def month_days(month, year=Date.today.year) mdays = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] mdays[2] = 29 if Date.leap?(year)mdays[month] end Simple examples: month_days(1) => 31 month_days(2, 2007) => [...]

Continue Reading

25 July 2007 ~ 1 Comment

Quick Start with Rails on OS X

Install Ruby OS X (10.4) comes with Ruby 1.8.2 already installed. For a quick start this is OK so let’s install Rails. Install Rails Since Rails comes as gem package, first we need to install RubyGems. Download the latest package from RubyForge and unzip it. Now go to the directory where you unpacked the package [...]

Continue Reading