Class: Refinery::Redirections::RoutesConstraint

Inherits:
Object
  • Object
show all
Defined in:
lib/refinery/redirections/routes_constraint.rb

Class Method Summary collapse

Class Method Details

.matches?(request) ⇒ Boolean

A redirection must be found in the database

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/refinery/redirections/routes_constraint.rb', line 5

def self.matches?(request)

  redirection = Refinery::Redirections::Redirection.from_url(request.fullpath).first

  if redirection.nil?
    Rails.logger.info "[Redirections] Redirection not found for: #{request.fullpath.inspect}"
  else
    Rails.logger.info "[Redirections] Redirection found from: #{request.fullpath.inspect} to #{redirection.to_url} with status #{redirection.status_code}"
  end

  !redirection.nil?

end