Giter VIP home page Giter VIP logo

rails_training's Introduction

Welcome to training.

Git

  • A distributed version control system.
  • You can edit code on the plane, commit it, test it and then merge it with everyone elses code when you land.

Messing with a git repository.

mkdir test
cd test
git init
echo "Hello world" > file.txt
git add .
git commit
echo "Hello world again" >> file.txt
git diff
git status
git add file.txt
git commit
git log
echo "Goodbye" >> file.txt
git diff
git status
git add file.txt
git commit
git log
git checkout <SHA OF COMMIT>
git checkout master
git log -p
git checkout -b test-branch
git checkout master

Make sure you play with creating a github repository.

Setup

bundle install
cp config/database.yml.sample config/database.yml

Update file with your config.

rake db:setup
rails server

Open http://localhost:3000/products

Database

rails dbconsole

Migrations

rails generate migration add_active_to_products

Add migration.

rake db:migrate

Rake

rake -T

List all rake tasks in the system that have a description.

  • db:setup - setup the database from scratch
  • db:reset - drop and recreate/setup the database from scratch
  • routes - list all routes

Rake tasks go in lib/tasks.

Seed

rake db:seed

Make sure you write your seed files so that they can be re-run on a database and it won't add duplicate data.

Assets

Asset pipeline is a way for rails to combine, minify and compress your assets so that the user gets the fastest experience. It provides dependency management for asset files and provides simple tools that get run when you deploy your application.

rake assets:precompile

Debugging

rails console

rails console production runs console using the production environment.

rails dbconsole

Rspec

Update gem file.

rails generate rspec:install
mkdir spec/models
mkdir spec/controllers
rake db:test:prepare

Running specs

rspec

rails_training's People

Contributors

carlwoodward 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.