Class: Constraints::UserUrlConstrainer

Inherits:
Object
  • Object
show all
Defined in:
lib/constraints/user_url_constrainer.rb

Instance Method Summary collapse

Instance Method Details

#matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
# File 'lib/constraints/user_url_constrainer.rb', line 5

def matches?(request)
  full_path = request.params[:username]

  return false unless NamespacePathValidator.valid_path?(full_path)

  User.find_by_full_path(full_path, follow_redirects: request.get?).present?
end