Skip to content

Commit 3785282

Browse files
authored
Add source to ecto schema metadata as in the code (#3717)
1 parent b5dcb8d commit 3785282

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

guides/introduction/Getting Started.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ A successful insertion will return a tuple, like so:
237237

238238
```elixir
239239
{:ok,
240-
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded>, age: nil,
240+
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded, "people">, age: nil,
241241
first_name: nil, id: 1, last_name: nil}}
242242
```
243243

@@ -332,7 +332,7 @@ The changeset does not have errors, and is valid. Therefore if we try to insert
332332
```elixir
333333
Friends.Repo.insert(changeset)
334334
#=> {:ok,
335-
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded>, age: nil,
335+
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded, "people">, age: nil,
336336
first_name: "Ryan", id: 3, last_name: "Bigg"}}
337337
```
338338

@@ -481,15 +481,15 @@ Friends.Person |> Ecto.Query.first |> Friends.Repo.one
481481
The `one` function retrieves just one record from our database and returns a new struct from the `Friends.Person` module:
482482

483483
```elixir
484-
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded>, age: 28,
484+
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded, "people">, age: 28,
485485
first_name: "Ryan", id: 1, last_name: "Bigg"}
486486
```
487487

488488
Similar to `first`, there is also `last`:
489489

490490
```elixir
491491
Friends.Person |> Ecto.Query.last |> Friends.Repo.one
492-
#=> %Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded>, age: 26,
492+
#=> %Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded, "people">, age: 26,
493493
first_name: "Jane", id: 3, last_name: "Smith"}
494494
```
495495

@@ -535,11 +535,11 @@ Friends.Person |> Friends.Repo.all
535535
This will return a `Friends.Person` struct representation of all the records that currently exist within our `people` table:
536536

537537
```elixir
538-
[%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded>, age: 28,
538+
[%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded, "people">, age: 28,
539539
first_name: "Ryan", id: 1, last_name: "Bigg"},
540-
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded>, age: 27,
540+
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded, "people">, age: 27,
541541
first_name: "John", id: 2, last_name: "Smith"},
542-
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded>, age: 26,
542+
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded, "people">, age: 26,
543543
first_name: "Jane", id: 3, last_name: "Smith"}]
544544
```
545545

@@ -549,7 +549,7 @@ To fetch a record based on its ID, you use the `get` function:
549549

550550
```elixir
551551
Friends.Person |> Friends.Repo.get(1)
552-
#=> %Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded>, age: 28,
552+
#=> %Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded, "people">, age: 28,
553553
first_name: "Ryan", id: 1, last_name: "Bigg"}
554554
```
555555

@@ -559,7 +559,7 @@ If we want to get a record based on something other than the `id` attribute, we
559559

560560
```elixir
561561
Friends.Person |> Friends.Repo.get_by(first_name: "Ryan")
562-
#=> %Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded>, age: 28,
562+
#=> %Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded, "people">, age: 28,
563563
first_name: "Ryan", id: 1, last_name: "Bigg"}
564564
```
565565

@@ -572,9 +572,9 @@ Friends.Person |> Ecto.Query.where(last_name: "Smith") |> Friends.Repo.all
572572
```
573573

574574
```elixir
575-
[%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded>, age: 27,
575+
[%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded, "people">, age: 27,
576576
first_name: "John", id: 2, last_name: "Smith"},
577-
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded>, age: 26,
577+
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded, "people">, age: 26,
578578
first_name: "Jane", id: 3, last_name: "Smith"}]
579579
```
580580

@@ -686,7 +686,7 @@ Just like `Friends.Repo.insert`, `Friends.Repo.update` will return a tuple:
686686

687687
```elixir
688688
{:ok,
689-
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded>, age: 29,
689+
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:loaded, "people">, age: 29,
690690
first_name: "Ryan", id: 1, last_name: "Bigg"}}
691691
```
692692

@@ -759,7 +759,7 @@ Similar to updating, we must first fetch a record from the database and then cal
759759
person = Friends.Repo.get(Friends.Person, 1)
760760
Friends.Repo.delete(person)
761761
#=> {:ok,
762-
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:deleted>, age: 29,
762+
%Friends.Person{__meta__: #Ecto.Schema.Metadata<:deleted, "people">, age: 29,
763763
first_name: "Ryan", id: 2, last_name: "Bigg"}}
764764
```
765765

0 commit comments

Comments
 (0)