bullet_train icon indicating copy to clipboard operation
bullet_train copied to clipboard

Create a `has_one` Super Scaffolding template.

Open andrewculver opened this issue 2 years ago • 4 comments

andrewculver avatar Apr 19 '22 13:04 andrewculver

+1

thedumbtechguy avatar Aug 27 '22 07:08 thedumbtechguy

Considering tackling this one next

gazayas avatar Feb 15 '23 05:02 gazayas

Before moving forward, I wonder if it would be beneficial to make a ReflectionBuilder class. That way we could extract some code out of the Transformer and refactor the code where belongs_to, has_many, and has_one overlap.

In the future (if needed), we could potentially add support for composed_of as well.

https://github.com/rails/rails/blob/218ec10df8ec9a84a5090b5c2b985dfcd8e7b820/activerecord/lib/active_record/reflection.rb#L33-L46

gazayas avatar Feb 15 '23 06:02 gazayas

Rails has an ActiveRecord::Associations::Builder with the different associations in the same directory, but I think this is inherently different from what we want to do (build the line that goes in the model).

Maybe could use a different name (ReflectionLineBuilder).

gazayas avatar Feb 15 '23 07:02 gazayas