Rails 4.2.3 使用特定于控制器的资产设计设置

Rails 4.2.3 Devise setup with Controller-specific Assets

我正在使用 Controller-specific Assets configuration, it woks perfectly except with the newly installed [Rails-Devise] authentication bundle (https://github.com/plataformatec/devise).

例如注册页面(控制器devise/registrations),/stylesheets/devise/registrations.css/javascripts/devise/registrations.js上的资产未加载(404)。

当我重新激活

时,Devise 工作正常

application.js

//= require_tree .

application.css

*= require_tree .

但是: 是否可以以允许保留控制器特定资产的方式添加设计 gem 的资产?

谢谢,

Devise doesn't have any stylesheet or javascript assets.

--

您最好在布局中使用一些条件逻辑,以确定您是否使用 devise_controller

#app/views/layouts/application.html.erb
stylesheet_link_tag :application, (controller_name unless devise_controller?)

这使用 devise_controller? helper