-
Notifications
You must be signed in to change notification settings - Fork 2
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
Use Ecto.Changeset for associations between items/person and statuses #94
Comments
- Update association to use Ecto.Changeset functions - Make sure seeds file can creates statuses and person related to: #94
I've update the migrations files and schema to create the associations (see 422a854) I'm now looking at updating the |
def list_items do
query =
from i in Item,
join: s in assoc(i, :status),
where: s.text != :deleted,
preload: [status: s]
Repo.all(query)
end Example from: http://blog.plataformatec.com.br/2015/08/working-with-ecto-associations-and-embeds/ |
Update the list_item function to checkt the status ecto assocation value is not "deleted" ref: #94 (comment)
@SimonLab apologies for not making this clear ... One of the advantages of having and they are already defined in I'm considering removing the status table from the database completely If you look through the history of the "Update MVP" issue #89 and PR #90 commits - both still very much Work-in-Progress - you will see that I've "changed my mind" a few times in order to simplify this. Like I removed Adding associations can be useful if that's what we want. But we [probably] don't need them in the MVP. "La
|
Closing as PR is merged. ✅ Please let me finish my PR #90 🙏 I will assign it for review when I feel that it's got nothing left to be removed. 🤞 |
on re-reading my comments above, it's clear to me that I was rude and ungrateful. 🤦♂️ |
Once #93 is completed, I can review how the association are defined in the application and use the
has_one
,belongs_to
,has_many
changeset functions to create and manage these links with Ecto. I think this will enhance the readability of some codeThe text was updated successfully, but these errors were encountered: