Sha256: 6304371d24e3e51d6ab3cd80ce524cab61ea288a8dcac8f636381e6a539af8ac
Contents?: true
Size: 524 Bytes
Versions: 5
Compression:
Stored size: 524 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_scaffold/static_pages#index", file_path: path end end
Version data entries
5 entries across 5 versions & 1 rubygems