Sha256: 41a43a467e69a3828da8ed633f9808508b36cb4c3d299630b5a781ba20ab3cfc

Contents?: true

Size: 502 Bytes

Versions: 15

Compression:

Stored size: 502 Bytes

Contents

module ActiveTools
  module ActiveRecord
    module RecordId
      extend ::ActiveSupport::Concern
      
      included do
      end
      
      module ClassMethods
      end
      
      def record_id
        "#{self.class.model_name.singular}_#{try(self.class.primary_key)||uniq_id}"
      end

      def uniq_id
        @_uniq_id ||= Base64.urlsafe_encode64(Time.now.send(:_dump))[0..-2]
      end
      
    end
  end
  
  module OnLoadActiveRecord
    include ActiveRecord::RecordId
  end
  
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
active_tools-0.2.5 lib/active_tools/active_record/record_id.rb
active_tools-0.2.4 lib/active_tools/active_record/record_id.rb
active_tools-0.2.3 lib/active_tools/active_record/record_id.rb
active_tools-0.2.2 lib/active_tools/active_record/record_id.rb
active_tools-0.2.1 lib/active_tools/active_record/record_id.rb
active_tools-0.2.0 lib/active_tools/active_record/record_id.rb
active_tools-0.1.4 lib/active_tools/active_record/record_id.rb
active_tools-0.1.3 lib/active_tools/active_record/record_id.rb
active_tools-0.1.2 lib/active_tools/active_record/record_id.rb
active_tools-0.1.1 lib/active_tools/active_record/record_id.rb
active_tools-0.1.0 lib/active_tools/active_record/record_id.rb
active_tools-0.0.52 lib/active_tools/active_record/record_id.rb
active_tools-0.0.51 lib/active_tools/active_record/record_id.rb
active_tools-0.0.50 lib/active_tools/active_record/record_id.rb
active_tools-0.0.42 lib/active_tools/active_record/record_id.rb