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

Joan Gabun asked in General

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.

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 81,149+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2024 GoRails, LLC. All rights reserved.