Sha256: dcee1069eade08aac4bcebb2fb257d3132bbe31721377eee04644b248e686f98

Contents?: true

Size: 313 Bytes

Versions: 7

Compression:

Stored size: 313 Bytes

Contents

# frozen_string_literal: true

module EncodedId
  module Rails
    module QueryMethods
      def where_encoded_id(slugged_encoded_id)
        decoded_id = decode_encoded_id(slugged_encoded_id)
        raise ActiveRecord::RecordNotFound if decoded_id.nil?
        where(id: decoded_id)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
encoded_id-rails-1.0.0.beta3 lib/encoded_id/rails/query_methods.rb
encoded_id-rails-1.0.0.beta2 lib/encoded_id/rails/query_methods.rb
encoded_id-rails-1.0.0.beta1 lib/encoded_id/rails/query_methods.rb
encoded_id-rails-0.6.2 lib/encoded_id/rails/query_methods.rb
encoded_id-rails-0.6.1 lib/encoded_id/rails/query_methods.rb
encoded_id-rails-0.6.0 lib/encoded_id/rails/query_methods.rb
encoded_id-rails-0.5.0 lib/encoded_id/rails/query_methods.rb