Sha256: b65f739483fa10c9cede1f548ccd7e52a955af286272b4e97f0a364fa85b45d7

Contents?: true

Size: 332 Bytes

Versions: 5

Compression:

Stored size: 332 Bytes

Contents

class CatchAllController < ActionController::Base
  def resolve
    redirect = ::Redirect.find_by(source_uri: request.path)

    if redirect && redirect.enabled?
      redirect.used!
      redirect_to redirect.destination_uri, status: redirect.status_code
    else
      render text: 'Page not found', status: 404
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
udongo-1.0.3 app/controllers/catch_all_controller.rb
udongo-1.0.2 app/controllers/catch_all_controller.rb
udongo-1.0.1 app/controllers/catch_all_controller.rb
udongo-1.0.0 app/controllers/catch_all_controller.rb
udongo-0.1.0 app/controllers/catch_all_controller.rb