Crucial LOC missing in ruby preview example

The documentation for the preview functionality for Ruby is missing crucial line of code.
In your Rails starter there's an additional LOC setting the preview cookie value to the preview token created when clicking "Preview" in prismic.
In the documentation this line is missing.

It took me quite some time to figure out why my previews were not working, since I had copied your supplied code but still couldn't get it running.

Page of documentation: Previews and the Prismic Toolbar with Ruby - Prismic

Missing LOC

cookies[Prismic::PREVIEW_COOKIE] = { value: preview_token, expires: 30.minutes.from_now }

I think it would be good if the documentation was updated to match the starter repo.

Hi David,

Welcome to the Prismic community,

Before troubleshooting this issue, I would like to be sure it is not related to the preview issue that we have just deployed a fix to it today.

For that, can you please re-check if it is working now without the change that you have proposed? And would be great if you can share your repository name (in a private message if necessary).


Also I've added that line to the documentation and the change is pending for review, thanks for reporting that.

Hi @Fares!
Unfortunately I haven't had the time to test without the explicitly setting the cookie.
Let me know in case you figure out if it's needed or not, otherwise I'll hopefully be able to test within the coming week.

1 Like

Thanks, @david5 for your response, In fact, I might not have the time to install the Ruby kit, and I don't have much experience in Ruby to run the sample project.

It would be really appreciated if you can have some time to test that in the coming weeks.