Skip to content

Commit 6ba4e5b

Browse files
authored
Update README.md
1 parent b5ca246 commit 6ba4e5b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,17 @@ mkdir mkdir app/controllers/api && mkdir app/controllers/api/v1
162162
If everything looks right you should see your directory identical as below. <br><br>
163163
<a href="http://tinypic.com?ref=3589c11" target="_blank"><img src="http://i67.tinypic.com/3589c11.png" height="280" width="280" border="0" alt="Image and video hosting by TinyPic"></a>
164164

165+
Now that our versioning is complete, let's test out a model and controller to work with our new url of ```localhost:3000/api/v1```. Let's scaffold a test model/controller and call it ```movies```
166+
167+
```ruby
168+
rails g scaffold Movies name:string rating:integer
169+
170+
rails db:migrate
171+
```
172+
173+
The Rails engine creates your controller in the default ```/controllers``` directory but we need to move our new controller into the ```api/v1``` directory. You can either move it manually or the following:
174+
175+
```shell
176+
mv app/controllers/movies_controller.rb app/controllers/api/v1
177+
```
178+

0 commit comments

Comments
 (0)