Super episode -- putting this to work right now.
Reply
Thanks Chris - loved the episode: very informative. Lovely dynamic refactoring work, too, imho
Reply
The refactoring part is half the fun. π
Reply
Thank you very much, Chris - I really enjoyed that episode
Reply
Glad you found it helpful!
Reply
Great episode Chris, super cool explanation how it works behind the scenes!
Reply
These are my favorite kinds of things to learn and teach. Learning behind the scenes really helps you become a better developer. πͺ
Reply
This is great! I wonder how easy it would be to get unit tests setup to do this kind of thing:
button = Components::Button.new(text: "Click me")
result = button.render_in(view_context)
expect(result).to include("Click me")
Using RSpec, I could imagine creating "component" type tests where the view_context
is available in them. I don't actually know how to make it available but i'd love to know how.
Reply
I guess you could write a view spec and do this:
render Button.new(to: "some-path")
expect(rendered).to include("href=\"some-path\"")
Reply
Yep, you would want to treat them as a view specs because that's what they are. view_context
is an instance of ActionView::Base. π
Reply
Great. That was a really useful video, thanks Chris!
Reply
Didn't know about the ... nor the !!@variable very nice π€―
Reply
Cool epicode, let me think why I need gem ViewComponent, lol. Thanks, Chris.
Reply
With gem ViewComponent, how to make component render partial in it's self directory as action view?
Reply