Notes posted by hannu

RSS feed
February 17, 2009
4 thanks

Date_select with assert_valid_keys

If you are using date_select with assert_valid_keys you have to allow 3 parameters named field(1i), field(2i) and field(3i).

For example with field

date_select("post", "written_on")

You have to allow following fields:

params[:post].assert_valid_keys( 
  'written_on(1i)', 'written_on(2i)', 'written_on(3i)'
)
June 20, 2008
10 thanks

Set cache time-to-live

You can specify time-to-live for the cached item in seconds with :expires_in option.

class ListsController < ApplicationController
  caches_action :index, :expires_in => 1.hour
end