|
|
@ -40,3 +40,29 @@ Question 3.2 :
|
|
|
|
|
|
|
|
|
|
|
|
* `rails db:seed`
|
|
|
|
* `rails db:seed`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## TP4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Question 2.5 :
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* J'ajoute une créature avec des PVs à 0 :
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
|
|
|
|
❯ rails console
|
|
|
|
|
|
|
|
Loading development environment (Rails 7.0.4.3)
|
|
|
|
|
|
|
|
irb(main):001:0> Creature.create(name: 'Zombie', health_points: 0)
|
|
|
|
|
|
|
|
TRANSACTION (0.1ms) begin transaction
|
|
|
|
|
|
|
|
Creature Create (0.4ms) INSERT INTO "creatures" ("name", "health_points", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "Zombie"], ["health_points", 0], ["created_at", "2023-03-26 14:00:56.413028"], ["updated_at", "2023-03-26 14:00:56.413028"]]
|
|
|
|
|
|
|
|
TRANSACTION (0.9ms) commit transaction
|
|
|
|
|
|
|
|
=>
|
|
|
|
|
|
|
|
#<Creature:0x00000001104b9310
|
|
|
|
|
|
|
|
id: 27,
|
|
|
|
|
|
|
|
name: "Zombie",
|
|
|
|
|
|
|
|
health_points: 0,
|
|
|
|
|
|
|
|
created_at: Sun, 26 Mar 2023 14:00:56.413028000 UTC +00:00,
|
|
|
|
|
|
|
|
updated_at: Sun, 26 Mar 2023 14:00:56.413028000 UTC +00:00>
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* J'essaie de renommer la créature dans postman et je vérifie que son nom ne change pas
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* J'ai bien une 404 et son nom n'a pas changé
|
|
|
|
|
|
|
|
|
|
|
|