I have implemented a controller in my application that utilizes a custom layout named "special":
class SessionsController < ApplicationController
layout "special"
...
end
To complement this, I have created a new layouts/special.html.erb
file:
<!DOCTYPE html>
<html>
<head>
<title></title>
<%= stylesheet_link_tag "special" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>
In addition, I have also generated a corresponding stylesheets/special.css
file.
The issue arises when attempting to access the page with the "special" layout, resulting in an exception being thrown:
Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError in Sessions#new
special.css isn't precompiled
Despite running
bundle exec rake assets:precompile
, the problem persists. What could be causing this issue? How can I correctly link a stylesheet to a layout in Rails?