background |
---|
A bog is a mire that accumulates peat, a deposit of dead plant material—often mosses. |
Researchers at your local biology lab are exploring and documenting a series of bogs, and the creatures of interest. Our job is to encourage people in the community to explore the bogs and submit their findings using our web application.
We'll be creating a single model app to demonstrate editing resources. It's important to get comfortable with the process of starting a new Rails app since you'll be doing that for quite awhile
##Components
- A creature model that stores
name
anddescription
- A controller for your home page
- A controller that manages bog creature
route | description | controller | action/view | bonus? |
---|---|---|---|---|
GET / | Your home page | home | index | no. |
GET /creatures | list all creatures | creatures | index | no. |
GET /creatures/new | show add creature form | creatures | new | no. |
POST /creatures | create creature | creatures | create (no view) | no. |
GET /creatures/1 | list creature | creatures | show | (id=1) |
GET /creatures/2/edit | show edit creature form (id=2) | creatures | edit | bonus |
PUT /creatures/3 | update an existing creature (id=3) | creatures | update | bonus |
##Recommended Process
###Create basic app
- Fork / clone
- cd into directory
- Create app
rails new ./ -T
- Test app
- Run server
rails s
- Goto localhost:3000
- Run server
###Build specific functionality
- Create model
rails g model ...
(you write the rest of this command) - Migrate
rake db:migrate
- Test models
- run console
rails c
- Try some stuff...
Creature.all
Creature.create
Createre.new
Creature.find
- ...etc ...etc
- run console
- Close console run
rails s
- Create routes...
- Add route to
routes.rb
- Add controller / action
- Add view
- Test (go to url in browser)
- Repeat for each view
- Add route to
- Add HTML to each view
- Use bootstrap
- Make it pretty... oh so pretty!!!
- Add code to make the app functional
- Make a navigation bar
- Make an edit form to edit an existing Creature
- Make a delete button for each Creature