Preview a view_component with form object passed - how to pass form object in preview? #1693
Unanswered
equivalent
asked this question in
Q&A
Replies: 1 comment
-
I'd recommend using preview templates here. If you still wish to use a preview defined in the current way, one thing to note is that the return value of form_with(model: Post.new) do |f|
name = :title
render(BulmaInputComponent.new(f, name))
end This is just speculation, though, so I'd recommend preview templates. With the solution above, I would recommend using the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I like the idea of passing form object to a ViewCompenent e.g:
_app/views/posts/form.html.erb
app/components/bulma_input_component.rb
app/components/bulma_input_component.html.erb
all works well 👍
However I'm struggling to get the preview working
it would be nice if there was an access in previews to the
helpers
something like :Any ideas ? 🙏
Beta Was this translation helpful? Give feedback.
All reactions