class Widget < ActiveRecord::Base # ... # Only for mysql # RANDOM() will work for sqlite def self.random find(:first, :order => "RAND()", :limit => 1) end end # and then... class SomeController < ApplicationController # ... def some_action @widget = Widget.random end end