How to render file in Rails 5 API?
问题 I have a single-page application written in React with Ruby on Rails back-end (API mode). Rails is also serving static files. I'm pointing Rails router to public/index.html , so my SPA could manage his own routing with react-router . This is common practice in order to make direct links and refresh to work. routes.rb match '*all', to: 'application#index', via: [:get] application_controller.rb class ApplicationController < ActionController::API def index render file: 'public/index.html' end