Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a way for has-one relationship use .create (created after #472) #475

Open
FCO opened this issue Mar 21, 2021 · 6 comments
Open

Create a way for has-one relationship use .create (created after #472) #475

FCO opened this issue Mar 21, 2021 · 6 comments

Comments

@FCO
Copy link
Owner

FCO commented Mar 21, 2021

take a look at #472

@FCO
Copy link
Owner Author

FCO commented May 4, 2021

The interesting part of it is that it is actually possible set attribute type to the model it is refers to. I.e.:
...
Foo.attr.WHICH # MyModel

@vrurg but on that case, Foo.attr should return a Red::Column to make it possible to be used inside .map, .grep, etc...

@FCO
Copy link
Owner Author

FCO commented Nov 4, 2021

As @jonathanstowe have said on the original issue, I think returning a model type would be the best way, it could use the .join-on (the same method we use to find joins) to create it with the right external ids... I'll give it a try as soon as possible!

If we do that change, should that generate a new API version?




@jonathanstowe
Copy link
Contributor

I don't think it needs a different API version, because Empty is false, a type object is false.

@FCO
Copy link
Owner Author

FCO commented Nov 6, 2021

I'm still trying to figure out why... but my change is working if I define the referencing's model as type and does not work if I define it as string:

image

@FCO
Copy link
Owner Author

FCO commented Nov 6, 2021

for now: #523

@FCO
Copy link
Owner Author

FCO commented Nov 9, 2021

There are still some bugs on it... but it seems to be mostly working...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants