Skip to content

sf-wdi-14/AnimalsZoo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 

Repository files navigation

Rails Zoo Lab

Your local zoo has hired you to build a web-based application (app). Based on the zoo's specifications, the app should catalogue every animal at the zoo.

Note: The app will not persist data nor have a login system; we will get to both shortly!

##User Stories The User should be able to...

  • Expect RESTful routing
  • See an Index of the existing animals on both the root page and /animals
    • Animals should have a name, photo, and bio. (For now we will not worry about hosting our own photos; you should link to external photos)
    • Next to each Animal have a link to the edit page & a delete button
  • Create a new Animal
    • Page should be accessible via a persistent link in their nav bar
    • The route for this and all other pages should be restful ie /animals/new
    • Post to animals#create then redirect to the index page
  • Delete an Animal
    • Redirect to the index page

How to get started

  1. Run rails new RailsZoo to settup your app using postgresql as the default database
  2. Name your databases in config/database.yml and then run rake db:create
  3. Write your own custom routes, if you need a good reference refer to the routes guide in the Rails Docs. I.e. * get '/animals/new', to: 'animals#new' * post '/animals', to: 'animals#create' * etc.
  4. Create a contoller you'll need
  5. Create a view that your controller renders
  6. Create a model for you animals that will store the data and behavior for them. Note: you will create an Animal class with class methods. It is also recommended you seed your site with some initial animal data. Here's a good starting point:
#animal.rb file in models folder

class Animal
  #seed animals
  @@animals = ["lions", "tigers", "bears", "elephants", "dolphins"]
  def self.all
    @@animals
  end
  def self.create(animal)
    @@animals.push(animal)
  end
end

And of course, you can always look back at notes from this afternoon to help you with properly configuring your routing, controllers and views.

Bonus

  1. Add routes and methods to allows the user to update an existing animal

  2. Include your own custom styling, bootstrap or another CSS framework in your application and style your blog.

  3. Include flash messages to display success and error messages for when an animal is created or deleted

About

Create a Rails App that displays Animals in a Zoo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published