Rails Crash Course

Book description

In Rails Crash Course, author Anthony Lewis shows you how to harness Rails to build web applications that are fast, stable, and secure.

Table of contents

  1. Rails Crash Course: A No-Nonsense Guide to Rails Development
  2. Foreword
  3. Acknowledgments
  4. Introduction
    1. Who This Book Is For
    2. Overview
    3. Installation
      1. Ruby, Rails, and Git
        1. Mac OS X
        2. Linux
        3. Windows
      2. Multiple Ruby Versions
        1. Installing rbenv
        2. Installing Ruby
  5. I. Ruby on Rails Fundamentals
    1. 1. Ruby Fundamentals
      1. Interactive Ruby
      2. Data Types
        1. Numbers
        2. Strings
        3. Symbols
        4. Arrays
        5. Hashes
        6. Booleans
      3. Constants
      4. Variables
      5. Control Flow
        1. Conditionals
        2. Iteration
      6. Methods
      7. Classes
        1. Class Methods
        2. Inheritance
      8. Summary
      9. Exercises
    2. 2. Rails Fundamentals
      1. Your First Rails Application
      2. Rails Principles
        1. Convention over Configuration
        2. Don’t Repeat Yourself
      3. Rails Architecture
        1. Model
        2. View
        3. Controller
      4. Rails Application Structure
        1. The app Directory
        2. The bin Directory
        3. The config Directory
        4. The db Directory
        5. The lib Directory
        6. The log Directory
        7. The public Directory
        8. The test Directory
        9. The tmp Directory
        10. The vendor Directory
      5. Rails Commands
        1. The gem Command
        2. The bundle Command
        3. The rake Command
        4. The rails Command
      6. Rails Scaffold
      7. Summary
      8. Exercises
    3. 3. Models
      1. The Post Model
      2. Active Record
      3. Create, Read, Update, and Delete
        1. Create
        2. Read
        3. Update
        4. Delete
      4. More Active Record Methods
        1. Query Conditions
        2. Calculations
      5. Migrations
        1. The Schema
        2. Adding a Column
        3. Inside the Author Migration
      6. Validations
        1. Adding a Validation
        2. Testing Data
      7. Associations
        1. Generating the Model
        2. Adding Associations
        3. Using Associations
          1. The has_many Methods
          2. The belongs_to Methods
      8. Summary
      9. Exercises
    4. 4. Controllers
      1. Representational State Transfer
      2. Routing
        1. Resources
          1. Nested Resources
          2. Restricted Resources
        2. Custom Routes
        3. The Root Route
        4. Paths and URLs
      3. Controller Actions
        1. A Brief Detour from Actions
          1. Parameters
          2. Render or Redirect
          3. Response Formats
          4. The Flash
        2. Back to Controller Actions
      4. Adding Comments
      5. Summary
      6. Exercises
    5. 5. Views
      1. Embedded Ruby
        1. Output
        2. Control Flow
        3. Comments
      2. Helpers
        1. URL Helpers
        2. Number Helpers
        3. Your Own Helpers
      3. The Posts Index Page
      4. Layouts
        1. Asset Tag Helpers
          1. stylesheet_link_tag
          2. javascript_include_tag
        2. CSRF Meta Tags Helper
        3. Yield
      5. Partials
        1. Collections
        2. Showing Comments
      6. Forms
        1. Form Helpers
        2. Form Errors
        3. Form Controls
      7. Comment Form
      8. Summary
      9. Exercises
    6. 6. Deployment
      1. Version Control
      2. Git
        1. Setup
        2. Getting Started
        3. Basic Usage
          1. Other Useful Commands
          2. Branches
          3. Remotes
      3. Heroku
        1. Getting Started
        2. Updating Your Gemfile
        3. Deploying Your Application
      4. Summary
      5. Part I Remarks
      6. Exercises
  6. II. Building A Social Net Working App
    1. 7. Advanced Ruby
      1. Modules
        1. Modules as Namespaces
        2. Modules as Mixins
          1. include
          2. prepend
          3. extend
      2. Ruby Object Model
        1. Ancestors
        2. Methods
        3. Class
      3. Introspection
      4. Duck Typing
      5. Metaprogramming
        1. define_method
        2. class_eval
        3. method_missing
      6. Summary
      7. Exercises
    2. 8. Advanced Active Record
      1. Advanced Data Modeling
        1. Self Join Associations
        2. Many-to-Many Associations
          1. has_and_belongs_to_many
          2. has_many :through
        3. Single-Table Inheritance
        4. Polymorphic Associations
      2. The Social Application
        1. User Model
        2. Post Models
        3. Comment Model
      3. Summary
      4. Exercises
    3. 9. Authentication
      1. The Authentication System
        1. Post Index and Show
        2. Sign Up
        3. Log In
          1. Sessions
          2. Implementation
        4. Current User
        5. Authenticate User
        6. Use Current User
      2. Summary
      3. Exercises
    4. 10. Testing
      1. Testing in Rails
        1. Preparing to Test
        2. Running Tests
        3. Using Fixtures
          1. User Fixtures
          2. Post Fixtures
        4. Putting Assertions to Work
        5. Eliminating Duplication with Callbacks
      2. Model Tests
      3. Controller Tests
        1. Controller Test Helpers
        2. Controller Test Assertions
      4. Integration Tests
        1. Integration Helpers
        2. Testing a Flow
      5. Adding Features with Test-Driven Development
        1. Show User
        2. Create Post
      6. Summary
      7. Exercises
    5. 11. Security
      1. Authorization Attacks
      2. Injection Attacks
        1. SQL Injection
          1. Bypassing an Authentication System
          2. Preventing SQL Injection
        2. Cross-Site Scripting
          1. Built-in Protection
          2. The sanitize method
      3. Cross-Site Request Forgery Attacks
        1. How CSRF Works
        2. Preventing CSRF
      4. Summary
      5. Exercises
    6. 12. Performance
      1. Built-in Optimization Features
        1. Asset Pipeline
          1. Manifests
          2. Debug Mode
          3. Asset Precompilation
        2. Turbolinks
          1. Turbolinks in Action
          2. JavaScript Events
      2. Code Optimizations
        1. Reducing Database Queries
          1. Examining SQL Output
          2. N + 1 Queries
        2. Pagination
      3. Caching
        1. Cache Keys
        2. Low-Level Caching
        3. Fragment Caching
        4. Issues
      4. Summary
      5. Exercises
    7. 13. Debugging
      1. The debug Helper
      2. The Rails Logger
        1. Log Levels
        2. Logging
      3. Debugger
        1. Entering the Debugger
        2. Debugger Commands
      4. Summary
      5. Exercises
    8. 14. Web APIs
      1. The GitHub API
      2. HTTP
        1. Status Codes
        2. Curl
      3. Authentication
      4. Your Own API
        1. API Routes
        2. API Controllers
        3. Customizing JSON Output
          1. as_json
          2. Jbuilder
        4. Token-Based Authentication
          1. Generating Tokens
          2. Authenticating Requests
          3. Using Token-Based Authentication
      5. Summary
      6. Exercises
    9. 15. Custom Deployment
      1. Virtual Private Servers
        1. Amazon AWS Setup
        2. Ubuntu Linux Setup
          1. Installing Ruby
          2. Installing Apache and Passenger
          3. Installing PostgreSQL
          4. Installing Build Tools
          5. Installing Gems
      2. Capistrano
        1. Getting Started
        2. Configuration
        3. Database Setup
        4. Secrets Setup
        5. Add to Git
        6. Deployment
        7. Adding a Virtual Host
      3. Summary
      4. Exercises
  7. A. Solutions
    1. Chapter 1
    2. Chapter 2
    3. Chapter 3
    4. Chapter 4
    5. Chapter 5
    6. Chapter 6
    7. Chapter 7
    8. Chapter 8
    9. Chapter 9
    10. Chapter 10
    11. Chapter 11
    12. Chapter 12
    13. Chapter 13
    14. Chapter 14
    15. Chapter 15
  8. Index
  9. About the Author
  10. Copyright

Product information

  • Title: Rails Crash Course
  • Author(s): Anthony Lewis
  • Release date: October 2014
  • Publisher(s): No Starch Press
  • ISBN: 9781593275723