This change enables the standard rails scaffold generator to create Phlex views instead of .erb templates.
It also wires up the generated controllers to these views. The actual look of the views is almost identical to the erb ones which means the generated standard tests all work fine.
The purpose is to showcase how Phlex can be used to create a (basic but well understood) object-oriented UI in Rails.
NB: the target of this change is phlex-rails:v1 - because there have been some breaking changes in v2 and because many people will not be able to move to Ruby 3.3 easily which v2 demands.
See the commit message for how to try this out manually.
I've been through the rails generator code and tried all the cases I can find including attachments, password digests and references.
Unfortnately I couldn't find an easy way to test this automatically without interfering with the existing test/dummy/app installation. There are issues with rails locking the application layout file, and with wanting to run the generated tests from within the test that generates them!
I'd be happy to add tests in if someone can suggest a good way to do it. Perhaps creating a dummy2 app? Or perhaps putting all this generation code in a new repo?
This change enables the standard rails scaffold generator to create
Phlex
views instead of.erb
templates.It also wires up the generated controllers to these views. The actual look of the views is almost identical to the erb ones which means the generated standard tests all work fine.
The purpose is to showcase how Phlex can be used to create a (basic but well understood) object-oriented UI in Rails.
NB: the target of this change is
phlex-rails:v1
- because there have been some breaking changes in v2 and because many people will not be able to move to Ruby 3.3 easily which v2 demands.See the commit message for how to try this out manually.
I've been through the rails generator code and tried all the cases I can find including attachments, password digests and references.
Unfortnately I couldn't find an easy way to test this automatically without interfering with the existing
test/dummy/app
installation. There are issues with rails locking the application layout file, and with wanting to run the generated tests from within the test that generates them!I'd be happy to add tests in if someone can suggest a good way to do it. Perhaps creating a dummy2 app? Or perhaps putting all this generation code in a new repo?