Module: ActiveRecord::Acts::UuidIt

Defined in:
lib/uuid_it.rb

Defined Under Namespace

Modules: InstanceMethods

Instance Method Summary collapse

Instance Method Details

#find_by_uuid(uuid) ⇒ Object



16
17
18
# File 'lib/uuid_it.rb', line 16

def find_by_uuid uuid
  return Uuid.find_by_uuidable_type_and_uuid(self.name, uuid).try(:uuidable)
end

#uuid_itObject



8
9
10
11
12
13
14
# File 'lib/uuid_it.rb', line 8

def uuid_it
  class_eval do
    send :include, InstanceMethods
    has_one :uuid_object, :as => :uuidable, :class_name => "Uuid", :dependent => :destroy
    after_create :assign_uuid
  end
end