Coder Social home page Coder Social logo

js-rails-as-api-discussion-questions-mvc-render-chi01-seng-ft-051120's Introduction

Discussion Questions: MVC and Rails Render

Objectives

  • Recall the MVC pattern from Rails
  • Identify what render does in a Rails controller
  • Implement controller actions that render different types

MVC Review Questions

Write your best answers to the following questions, then discuss with your group.

  1. What is the Model responsible for in MVC? What about the Controller? The View?
  2. Now that we are using JavaScript to build Single Page Applications, what changes do we need to make to the division of responsibilities in MVC? What is JavaScript responsible for? What is Rails responsible for?
  3. What kinds of formats can Rails render? List as many as you can. When you think you've got a full list, check out Rails Guide on Rendering to see if you missed any.
  4. Check out the other ways of sending data in Rails in the ActionController::DataStreaming documentation. Draw out how you would build a file download button.

Exercise

Check out the rails app in the rendering folder. bundle install and rails s to get things running.

Open config/routes.rb and app/controllers/responses_controller.rb. Add the render, send_data, and send_file lines to the controller so that all the routes work. Check them all by visiting the urls in the browser.

js-rails-as-api-discussion-questions-mvc-render-chi01-seng-ft-051120's People

Contributors

lizbur10 avatar dependabot[bot] avatar ipc103 avatar maxwellbenton avatar timothylevi avatar rrcobb avatar geluso avatar

Watchers

James Cloos avatar Kaitlin Vignali avatar Mohawk Greene avatar Victoria Thevenot avatar Bernard Mordan avatar Otha avatar raza jafri avatar  avatar Joe Cardarelli avatar The Learn Team avatar  avatar Ben Oren avatar Matt avatar Antoin avatar Alex Griffith avatar  avatar Amanda D'Avria avatar  avatar Ahmed avatar Nicole Kroese  avatar Dominique De León avatar  avatar Lisa Jiang avatar Vicki Aubin avatar  avatar  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.