Ask A Question

Notifications

You’re not receiving notifications from this thread.

Components with Phlex in Rails Discussion

I feel like components in Ruby are super duper handy for arguments and other complex helper methods. Phlex takes it a step further with the HTML helper methods so you don't even really have to leave Ruby while you're coding. Pretty cool stuff!

Reply

I love Phlex. I've added it our work codebase, starting with our email templates. Massive improvements!
Also used it in a few side projects at home, but I am not sure where to put the javascript?

Reply

How do components work with turbo frames and streams?

Reply

No different than html.erb views. Both just generate the HTML independently of the JavaScript.

Reply

Great intro to Phlex. Now I need to work out if I like it more than ViewComponents, and if I want to switch :)

Reply

Agreed, I've already migrated some views to ViewComponent, and now I'm at a crossroads.

Reply

Thanks, Adam, great intro to Phlex! I appreciate how you took one step at a time -- including the errors -- and didn't try to polish too much beforehand, letting us work through and fix the problems with you.

Reply

Я хочу переписать view на phlex, как быть с partial ? а как выводить collections ? я не понял принцип . Help

Reply

Thanks for the discussion and I can only agree! Only disadvantage, in partial on projects where cancancan is applied: Instance variables from the controller cannot work inside a view and have to be passed as argument. We are currently using HAML and on this point the advantages and disadvantages balance each other out.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.