Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Load view-specific CSS in Rails
def view_css
path = "views/#{params[:controller]}/#{params[:action]}"
stylesheet_link_tag(path) unless Rails.application.assets.find_asset(path).nil?
You can’t perform that action at this time.