def acts_as_random_id(options={:field => :id}, &block)
      before_create do |record|
        if block
          record.ensure_unique_id(options, &block)
        else
          record.ensure_unique_id(options) do
            rand(2_147_483_647) + 1 # mysql and SQLite type integer
          end
        end
      end
    end
def acts_as_random_id(options={:field => :id}, &block)
      before_create do |record|
        if block
          record.ensure_unique_id(options, &block)
        else
          record.ensure_unique_id(options) do
            rand(2_147_483_647) + 1 # mysql and SQLite type integer
          end
        end
      end
    end
Default options:
 :field => :id