GithubHelp home page GithubHelp logo

aschonely83 / rails-restful-index-action-lab-online-web-pt-090919 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from learn-co-students/rails-restful-index-action-lab-online-web-pt-090919

0.0 1.0 0.0 725 KB

License: Other

Ruby 83.28% JavaScript 1.75% CSS 1.81% HTML 13.16%

rails-restful-index-action-lab-online-web-pt-090919's Introduction

RESTful Index Action Lab

Objectives

  1. Draw a get route
  2. Map a route to a controller action
  3. Define a controller action
  4. Load instances from ActiveRecord into a controller instance variable
  5. Render a template
  6. Use an instance variable from a controller action in a template
  7. Iterate over an ActiveRecord collection in ERB
  8. Build a classical index action/view

RESTful Routes

In this lab you will walk through how to build each element required to render a list of students out in the browser. The RSpec/Capybara tests for this lab can be found in spec/features. Both tests should be passing to complete the lab.

Instructions

  • Run bundle install from your terminal

  • Create a route that is mapped to a students' controller index action, the resulting route should be /students

  • Create a controller for students and have it inherit from ApplicationController

  • Integrate a controller action in the students' controller for handling the index action

  • Have the new index action call the Student model and pull in a list of all of the students with Student.all and store it in an instance variable

  • Map an index.html.erb view file to the student controller and iterate over the list of students returned from the index action in the controller. The index.html.erb file should be placed within a view/students folder.

Resources

  • If you run into an ActiveRecord::PendingMigration error when you run the tests, try rake db:migrate RAILS_ENV=test in the terminal then run the tests again

Rails Routing from the Outside In

View RESTful Action Index Lab on Learn.co and start learning to code for free.

View RESTful Action Index Lab on Learn.co and start learning to code for free.

rails-restful-index-action-lab-online-web-pt-090919's People

Contributors

maxwellbenton avatar chromeboi avatar realandrewcohn avatar jordanhudgens avatar dependabot[bot] avatar annjohn avatar rrcobb avatar sylwiavargas avatar sgharms avatar drakeltheryuujin avatar meg-gutshall avatar jmburges avatar rocketneck avatar yberdysh avatar danielseehausen avatar pletcher avatar cs-j avatar aschonely83 avatar

Watchers

James Cloos 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.