ismasan (owner)

Revisions

gist: 212793 Download_button fork
public
Public Clone URL: git://gist.github.com/212793.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
# Create a unique, non-numeric ID for your ActiveRecord objects
 
require 'uuid' # http://github.com/assaf/uuid/
 
class User < ActiveRecord::Base
    sluggable_finder :hashed_slug #creates slug from custom attribute and stores it in "slug" field
 
    def hashed_slug #we define the custom attribute
        UUID.new.generate
    end
end