Hi all,

Whilst building a Single Page App that needs to serve the same static file 
for a number of routes, *and* have those routes available as URL helpers 
(for mail templates and tests primarily), I'm using this technique that 
allows static files to be declared in routes.rb like so:

Rails.application.routes.draw do
  ...
  # This route will serve public/index.html at the /login URL path, and have
  # URL helper named `login_path`:
  get "/login", to: static("index.html")

  # This route will serve public/index.html at the /register URL path, and
  # have URL helper named `new_user_registration_path`:
  get "/register", to: static("index.html"), as: :new_user_registration
  ...
end

Source and setup instructions: 
https://github.com/eliotsykes/rails-static-router

I would appreciate any feedback and if this would be a welcome contribution 
to actionpack.

Kindest regards,

Eliot

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to