Module: CssViews::ControllerMixins::InstanceMethods

Defined in:
lib/css_views/controller_mixins.rb

Instance Method Summary collapse

Instance Method Details

#showObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/css_views/controller_mixins.rb', line 17

def show
  configuration = self.class.configurations[params[:configuration_name]]
  head :not_found unless configuration
  
  handler = configuration.handler(self)
  if perform_caching
    fresh_when(:etag=>handler.etag, :last_modified=>handler.last_modified, :public=>true)
    if params[:cache_buster]
      response.headers['Cache-Control']= 'public, max-age=31557600'
      response.headers['Expires'] = 1.year.from_now.httpdate
    end
    return if performed?
  end
  render :text=>handler.render, :type=>Mime::CSS 
end