Git Product home page Git Product logo

022221-intro-to-rails's Introduction

Intro to Rails

You can either fork & clone this repo down and run:

  • bundle install
  • rails db:migrate
  • rails db:seed
  • rails s

...or follow the allong with the lecture which will have you recreate it yourself

Learning Goals

  1. Create a rails app

    • learn about the --skip flag
  2. Create our Models, Views folders, Controllers, Migrations

    • With rails commands
    • Manually
  3. Successfully create at least and index and show page

    • Demonstrate how to pass data from the controller to the view
    • Demo object relationships

Stretch Goals

  1. Intro to rails helper methods
    • link_to

Domain

  1. Cyclists
  2. Trails
  3. Ride

Cyclist -< Ride >- Trail

Important Notes

  • Understand your file structure --> Rails generates a lot of ish for you, it's good to understand what and where things are when troubleshooting

  • Casing matters --> Rails is connecting coresponding names together based on correct casing convetions. This is how rails knows how to separate words.

  • Pluralization matters -->

    • Models are singular
    • Controllers, Migrations, and View folders are plural
    • In the model, object relationship pluralization is based on the relationship
    • You can use .pluralize on a string to see what the plural version of a word is in rails (example: "cat".pluralize returns "cats")
  • rails new skip flags: --skip-javascript --skip-active-storage --skip-action-mailer --skip-action-mailbox

  • Request response cylce demo:

  1. A route is defined in your routes file where you tell ruby what code to run when that route is hit
  2. When a browser hits that route, the coresponding controller method fires off
  3. When that controller method fires off, it follows the rules set in the model, and send that data to its corresponding view
  4. Back in the browser, the view can then display data from the data base by way of the controller.

022221-intro-to-rails's People

Contributors

angeloxenakis avatar

Watchers

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