Scheduling Posts Discussion
Great tutorial - thanks! While everything appears to be working fine, I'm still running into the turbolinks caching issues you spoke of at the ~22min mark even after installing the jquery-turbolinks gem (and restarting the server). Is there some additional configuration that needs to happen in order for the gem to prevent that buggy js behavior? Thanks in advance!
That's a great question Brian. I think that what I was experiencing was that the jQuery code I wrote never gets re-executed when the page changes via Turbolinks. Usually jquery-turbolinks fixes that by hijacking the page change event and that automatically fixes it. You might double check to make sure that jquery-turbolinks is being included in your application.js file properly. That's about the only thing that I can think of off the top of my head.
I've gone through this, but when trying to load the form. I get `undefined method `published_at?' for nil:NilClass`.
My helper to my eye, looks word for word as per the example: (my model is article, not post)
if article.published_at > Time.zone.now
To fix the Turbolinks issue you could put your js into a wrapper like this:
What do you guys think?
Since Rails 6, to the best of my knowledge, no longer supports CoffeeScript, do you have a suggestion for using this with Webpack for those who aren't familiar with Coffee Script?
I followed this video to add draft and scheduled post to Rails 6 a few weeks ago. I ran into one issue with the Publish At dates showing when first going to the Article page. But when the page was refreshed, it worked properly.
I found at that time, if I changed the following in application.js require("turbolinks").start() to require("turbolinks") - it behaved as you would expect.
I've now add AJAX uploading and needed to add some further jQuery. This made me have to re-add the .start() to the turbolinks require.
Any suggestions on how I can have this work properly with Rails 6?