class Category < ActiveRecord::Base
acts_as_tree :order=>position
scope :top, where("parent_id is null")
scope :sub, where("parent_id is not null")
before_create:add_uuid
private
def add_uuid
require 'uuid'
self.uuid=UUID.new.generate
end
end
i used a uuid plugin into rails
i have test the code UUID.new.generate in rails console enviroment it's working fine. but when i put it to Category Model,it didn't work,i'm newbie on rails,hope someone could help me