Demystifying Ruby on Rails Johan Pretorius Pretoria.rb - 20 August 2014 rubyonrails.org
de·mys·ti·fy Scratching the surface is more like it :-) In 30-45 minutes? verb make (a subject) clearer and easier to understand.
Philosophy Don’t Repeat Yourself - DRY “Every piece of knowledge must have a single unambiguous, authoritative representation within a system.”
Philosophy Convention over Configuration Rails is opinionated software, and defaults to this set of conventions.
Bootstrapping • Linux or Mac OS X • Ruby 2.1.2 (rvm / rbenv) • Rails 4.1.x (4.1.4) • Sublime Text / vim / Rubymine • oh-my-zsh / git Our Development Environment
Bootstrapping Application Generators • Rails Composer • Thoughtbot Suspenders • Renderedtext base-app
Bootstrapping Rails Composer Starter Apps • rails-bootstrap • rails-omniauth • rails-devise • roll your own
Bootstrapping Rails Composer Options #1 • web server • database • template engine • test framework • front-end framework
Bootstrapping Rails Composer Options #2 • email setup • authentication • authorization • environment variables • deployment
Three Steps to Heaven • rails new bookapp -m composer.rb • cd bookapp • thin start Eddie Ochran, 1960: Three Steps to Heaven Bootstrapping
Bootstrapping Rails Internal Generators • rails generate • rails generate model • rails generate controller
Active Record The Active Record Pattern • object wraps a database row/view • encapsulates database access • adds domain logic on that data Martin Fowler: http://www.martinfowler.com/eaaCatalog/activeRecord.html
Active Record Convention over Configuration • naming conventions • schema conventions • query interface
Action Controller Again, smart conventions • naming conventions • methods & actions • parameters • sessions & cookies • XML & JSON data
Action View Browser UI • controllers render views • layouts: yield & content_for • assets and partials • form helpers
Asset Pipeline What is the Asset Pipeline? • concatenate JS/CSS • development vs production • organize application assets • package assets with a gem
Extending Rails RubyGem and Bundler • bundler.io • the Gemfile • useful gems
Deployment Deploying Rails applications is easy • automate with capistrano • Heroku • Digital Ocean • Amazon Web Services
Configuring Rails Adjust application behaviour • Initializer files • ORM configs • Rails environments • Internationalization (I18n)
Debugging Debugging utilities • pry (binding.pry) • log files • rails-footnotes • debug(params)
Rails on Rack Rails integration with Rack • rack.github.io • active admin • resque web interface • comfortable mexican sofa
Resque Web require ‘resque/server' mount Resque::Server.new, at: "/resque" config/routes.rb
Active Admin config/routes.rb ActiveAdmin.routes(self)
Comfortable Mexican Sofa ComfortableMexicanSofa::Routing.admin (:path => '/cms-admin') # Make sure this routeset is defined last ComfortableMexicanSofa::Routing.content (:path => '/home', :sitemap => false) config/routes.rb
Resources #1 Ruby on Rails Guides Rails Composer thoughtbot/suspenders Ruby Version Manager Rails Release Notes
Resources #2 Manning Ruby Guides Planet Ruby on Rails Stackoverflow RailsBridge O'Reilly Rails Tutorial Avdi's Ruby Tapas rails / rails Pragmatic
Rails Reading Agile Web Development with Rails Crafting Rails 4 Applications Growing Rails Applications in Practice The Rails 4 Way Rails AntiPatterns Rails 4 In Action
About me flickr -> qoolpix twitter instagram -> qoolpix about.me/johanpretorius -> @johan__
rails/rails punchcard

Demystifying Ruby on Rails