|
|
|
@ -16,3 +16,21 @@ Question 3 :
|
|
|
|
|
* La migration n'est pas lancée sur la base
|
|
|
|
|
* `rails db:migrate`
|
|
|
|
|
|
|
|
|
|
* Question 3.1 :
|
|
|
|
|
|
|
|
|
|
Je teste la creature dans une console rails que je lance avec `rails console` :
|
|
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
|
❯ rails console
|
|
|
|
|
Loading development environment (Rails 7.0.4.3)
|
|
|
|
|
irb(main):001:0> c = Creature.create(name: "Thrall", health_points: 489)
|
|
|
|
|
TRANSACTION (0.1ms) begin transaction
|
|
|
|
|
Creature Create (0.4ms) INSERT INTO "creatures" ("name", "health_points", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "Thrall"], ["health_points", 489], ["created_at", "2023-03-26 13:19:57.492017"], ["updated_at", "2023-03-26 13:19:57.492017"]]
|
|
|
|
|
TRANSACTION (0.9ms) commit transaction
|
|
|
|
|
=>
|
|
|
|
|
#<Creature:0x00000001070374f8
|
|
|
|
|
...
|
|
|
|
|
irb(main):002:0> c.to_label
|
|
|
|
|
=> "Thrall (489)"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|