Dynamic params taken from DB in preview files are not showing until restarting the server #374
-
Hi all, before anything, thanks so much for that amazing tool, it's really good. I'm using I'm trying to use dynamic params in #
# @param act_id select {{Act.last(10).pluck(:id)}} "Select one of the latest 10 acts"
# Everything works perfectly fine except when new Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @RaulSeSo, So the problem here is that Lookbook only reloads the preview files when it detects a change to the file itself - it doesn't know anything about changes in your database. It may be possible to trigger a manual update from within an active record callback, although I've never tried that myself. Something like this may work (for v1.3.3): class Act < ApplicationRecord
after_create do
Lookbook.engine.parser.parse
end
end Let me know how you get on if you have a chance give it a try 🙂 |
Beta Was this translation helpful? Give feedback.
Hi @RaulSeSo,
So the problem here is that Lookbook only reloads the preview files when it detects a change to the file itself - it doesn't know anything about changes in your database.
It may be possible to trigger a manual update from within an active record callback, although I've never tried that myself. Something like this may work (for v1.3.3):
Let me know how you get on if you have a chance give it a try 🙂