jdallien edited this page Sep 13, 2010 · 3 revisions
Clone this wiki locally


Error after upgrading to version 2.0.0 if you use uuid for primary keys in rails

If you are using UUIDTools for unique ids for your objects and you followed a tutorial like this one, then you may be surprised by this error:

  undefined method `timestamp_create' for UUID:Class

after upgrading. You should edit uuid_helper.rb in your app/helpers directory and replace this line:

    self.id = UUID.timestamp_create().to_s

by the following one

    self.id = UUIDTools::UUID.timestamp_create().to_s

so it might look like this:

require 'rubygems'
require 'uuidtools'
module UUIDHelper
  def before_create()
    self.id = UUIDTools::UUID.timestamp_create().to_s