Skip to content

Commit c3546b5

Browse files
committed
Add instructions for Ship.clear
Fixes #19
1 parent cbca1c2 commit c3546b5

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ In this lab, you'll practice using nested forms in Sinatra.
88

99
Note: YOU DO NOT NEED A DATABASE, since we just need to keep track of the forms input long enough to display it, and not persist it. We don't expect the pirate to be there the next time we come to his URL, but it'd be cool if he was.
1010

11-
In other words, store your ships in memory in a `@@ships` class variable.
12-
13-
1. Create two classes, a `Pirate` class and a `Ship` class. Pirates should have a name, weight, and height. You will also need a class method that returns all the pirates. The ship class should have name, type, and booty attributes, as well as a class method that returns all the ships.
11+
1. Create two classes, a `Pirate` class and a `Ship` class. Pirates should have a name, weight, and height. You will also need a class method that returns all the pirates. The ship class should have name, type, and booty attributes, as well as a class method `.all` that returns all the ships and a class method `.clear` that deletes all ships.
1412

1513
2. Make a nested form (this should probably have html `<label>`s so it makes sense to a user). This form will be creating three objects (one instance of the Pirate class, and two instances of the Ship class). Remember, you'll need to build a corresponding controller action to load this page. Your form should `POST` to the route `'/pirates'`.
1614

spec/01_sinatra_forms_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
end
7272

7373
after do
74-
Ship.ships = []
74+
Ship.clear
7575
end
7676

7777
it "returns a 200 status code" do

0 commit comments

Comments
 (0)