Sha256: b6c81765290d13ba68113e1ce7079784d11952acdad8aff219608c6418c865cd

Contents?: true

Size: 343 Bytes

Versions: 3

Compression:

Stored size: 343 Bytes

Contents

module Slugs
  module ActiveRecord
    module Relation
      extend ActiveSupport::Concern

      def find_one(id)
        (sluggable? and id.is_a? String) ? (find_by_slug(id) || super) : super
      end

      def exists?(id=false)
        (sluggable? and id.is_a? String) ? (exists_by_slug(id) || super) : super
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slugs-1.2.5 lib/slugs/active_record/relation.rb
slugs-1.2.4 lib/slugs/active_record/relation.rb
slugs-1.2.3 lib/slugs/active_record/relation.rb