https://github.com/markolson/sports_team_go
https://github.com/markolson/sports_team_go
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/markolson/sports_team_go
- Owner: markolson
- Created: 2016-01-24T16:06:09.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-11T23:54:04.000Z (about 10 years ago)
- Last Synced: 2025-03-02T12:18:47.674Z (over 1 year ago)
- Language: Elixir
- Size: 85.9 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SportsTeamGo
To start your Phoenix app:
1. Install dependencies with `mix deps.get`
2. Create and migrate your database with `mix ecto.create && mix ecto.migrate`
3. Start Phoenix endpoint with `mix phoenix.server`
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
Ready to run in production? Please [check our deployment guides](http://www.phoenixframework.org/docs/deployment).
## Learn more
* Official website: http://www.phoenixframework.org/
* Guides: http://phoenixframework.org/docs/overview
* Docs: http://hexdocs.pm/phoenix
* Mailing list: http://groups.google.com/group/phoenix-talk
* Source: https://github.com/phoenixframework/phoenix
### Queries
Repo.all from t in Team, preload: [:home_games]
a = Repo.all from g in Game, preload: [:home_team, :away_team]
IO.puts "#{a.away_team.name} @ #{a.home_team.name}. #{a.start} - #{a.end}"
changeset = TeamMember.changeset(%TeamMember{}, %{})
{status, changeset} = SportsTeamGo.Repo.insert(changeset)
#does not work
TeamMember.changeset(%TeamMember{}, %{team: team, user: user}) |> Repo.insert
# works
TeamMember.changeset(%TeamMember{}, %{team_id: team.id, user_id: user.id}) |> Repo.insert