Coder Social home page Coder Social logo

animalszoo's Introduction

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

animalszoo's People

Contributors

ilias-t avatar choskim avatar

Watchers

James Cloos avatar Delmer avatar Dennis Charles Hackethal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.