Ask A Question


You’re not receiving notifications from this thread.

Separate Asset Pipeline

Nelson asked in Rails

Im building a webapp that has an admin panel... I separated this by creating a new folder in the controllers 'admin' and also on my views... This way I can have two completely different styles, one for FE and one for the BE... I wanted to use tinymce for creating posts so installed the gem but I can only see the JS and CSS files showing up on the FE, nothing get loaded when I'm on the admin side unless I specifically enter the script tags... How can I bring specific libraries from the application.js file into my admin area?


Short answer: by using <%= javascript_include_tag 'admin', 'data-turbolinks-track': 'reload' %> and some conditional on the application.html. So if you're in the admin controller do display one specific css/js set and a different one if not.

Join the discussion
Create an account Log in

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

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

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