Sha256: a1bd57b36303375257a4e8c0c220dc310f2ace618b27310b2c832289915f5a02

Contents?: true

Size: 445 Bytes

Versions: 1

Compression:

Stored size: 445 Bytes

Contents

module PloymorphicModule

  def self.included(base)
    base.extend ClassMethods
  end  

  module ClassMethods

    def acts_as_wuid
      has_one :wuid, :as => :wuidable, :dependent => :destroy
      include PloymorphicModule::InstanceMethods
    end

  end

  module InstanceMethods

    def after_create 
      super
      create_wuid
    end 

    def create_wuid
      wuid.create
    end
 
    def wid
      wuid.id
    end

  end

end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ploymorphic_wuid-0.1.0 lib/wuid/ploymorphic_module.rb