Closed zavan closed 4 weeks ago
Thanks for opening this. Definitely should document that. You never need to think about this when using it with rails but definitely need it without rails.
I also faced this issue. I started a bare-bones experimental rack project just to use Phlex and I didn't know how to render the views. I even thought (after a few failed attempts) that I had to use it with a framework and it wasn't supposed to be used by itself. Then I checked the source code and I realized that call()
was all I needed.
Came here to create an issue.
Thanks @aesmail. I’m putting together a new documentation site at https://github.com/joeldrapper/phlex.fun but it's taking a while. There's also full API docs available here https://rubydoc.info/gems/phlex
I noticed that although the docs have a lot of examples of how to define the view classes, they don't mention how to render them (without Rails) at all (that I could find, maybe I missed it). I mean, what method do I call to get the HTML string?
I actually had to go and check the source code to find out you can call
.call
/.()
on an instance or call it on the class directly with the args (also aliased asrender
on the class):