Ficheros Estáticos

  1. Static files are served from the ./public directory.
  2. You can specify a different location by setting the :public_folder option:
    set :public_folder, File.dirname(__FILE__) + '/static'
    
    Put this code in a configure block
  3. Note that the public directory name is not included in the URL.
  4. A file ./public/css/style.css is made available as http://example.com/css/style.css.
  5. Use the :static_cache_control setting to add Cache-Control header info. Use an explicit array when setting multiple values:
     set :static_cache_control, [:public, :max_age => 300]
    
  6. What would be delivered in the event that a defined route conflicts with the name of the static resource?. The answer is the static resource.

Casiano Rodriguez León 2015-01-07