Skip to main content
Ask A Question
You’re not receiving notifications from this thread.

Rails 6: How do you associate specific stylesheet and external js plugin to a layout

General • Asked by Joan Gabun

I am working on Ruby on Rails 6. My application has a controller that uses a different layout called "special":

class BoxController < ApplicationController
  layout "special"

So I've created a new layouts/special.html.erb:

<!DOCTYPE html>
  <%= stylesheet_link_tag "special" %>
  <%= javascript_link_tag "special" %>
  <%= csrf_meta_tags %>
 <%= yield %>

I then placed my 3rd party css and plugin under vendor->stylesheets and javascript folder:



I tried this but did not read my css and js.

What am I doing wrong? What am I missing in order for this work?

Can anyone guide me step by step? a super beginner here.

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 31,353+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.