All threads / How do I integrate the local_time gem without using the asset pipeline?

Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do I integrate the local_time gem without using the asset pipeline?

Michael Raeford asked in Gems / Libraries

How do I add the local_time gem to my project without using the asset pipeline as shown in one of the tutorial videos on building a user forum (https://gorails.com/episodes/forum-time-zones-with-local_time?autoplay=1). More specifically, how do I add the local-time.js file to my app using the local_time gem, but not use the asset pipeline to do it? I see an option to add it using the npm package (see below) but I am not sure how this works and where to put it.

import LocalTime from "local-time"
LocalTime.start()

Please advise.

MDR

If you use the gem, you have to use the asset pipeline for it. This is what I would recommend anwyays. The asset pipeline is perfect for these things. Any reason why you're avoiding using the asset pipeline?

Join the discussion

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

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

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

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.