Can I Render A Layout Directly From routes.rb, Without A Controller?

后端 未结 3 444
面向向阳花
面向向阳花 2021-01-12 04:20

I would like to set up a pair of style guides for the admin and public sections of a website.

Each will need its own layout which will contain a mixture of static ht

3条回答
  •  余生分开走
    2021-01-12 05:11

    For some weird reason I wanted to render a blank JS file for a while, and writing a controller felt like too much for this kind of hack. Thanks to @genkilabs 's answer, I used this 3 liner:

    get 'analytics/some_file.js', to: -> (env) do
      [200, { 'Content-Type' => 'application/javascript' }, ['']]
    end
    

提交回复
热议问题