Sha256: 2057b972be5c1ebdaddd1fe64eaf3a376dab76459eaf97cb2463a24e9939a195

Contents?: true

Size: 293 Bytes

Versions: 7

Compression:

Stored size: 293 Bytes

Contents

# encoding: utf-8

module DataMapper
  module Aspects
    module Slug
      def self.included(base)
        base.property :slug, String, length: 75, unique: true
        def base.find_by_slug(slug)
          first(slug: slug, order: [:updated_at.desc])
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dm-aspects-0.1.0 lib/datamapper/aspects/slug.rb
dm-aspects-0.0.6 lib/datamapper/aspects/slug.rb
dm-aspects-0.0.5 lib/datamapper/aspects/slug.rb
dm-aspects-0.0.4 lib/datamapper/aspects/slug.rb
dm-aspects-0.0.3 lib/datamapper/aspects/slug.rb
dm-aspects-0.0.2 lib/datamapper/aspects/slug.rb
dm-aspects-0.0.1 lib/datamapper/aspects/slug.rb