Sha256: d213ce9250300dc003abd1be38bc323a69d775d0b8b1f3dd3af252ea79b8dc31

Contents?: true

Size: 515 Bytes

Versions: 1

Compression:

Stored size: 515 Bytes

Contents

# frozen_string_literal: true

Rails.application.routes.draw do
  parameter_regex = /\[([a-zA-Z0-9_-]+)\]/
  static_files_path = Rails.root.join("public").to_s
  static_files = File.join(static_files_path, "**", "index.html")

  Dir.glob(static_files).each do |path|
    next unless path.match?(parameter_regex)

    route = path[%r{#{Regexp.escape(static_files_path)}(.*)/index.html}, 1]
    route = route.gsub(parameter_regex, ':\1')

    get route, to: "next_rails/static_pages#index", file_path: path
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
next_rails_scaffold-0.1.9 config/routes.rb