Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Demystifying Ruby on Rails

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Demystifying Ruby on Rails

Presentation given at a recent Pretoria.rb meetup: http://www.meetup.com/pretoria-rb/events/197294922/

Avatar for johan pretorius

johan pretorius

August 21, 2014

Other Decks in Programming

Transcript

  1. de·mys·ti·fy Scratching the surface is more like it :-) In

    30-45 minutes? verb make (a subject) clearer and easier to understand.
  2. Philosophy Don’t Repeat Yourself - DRY “Every piece of knowledge

    must have a single unambiguous, authoritative representation within a system.”
  3. 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
  4. Bootstrapping Rails Composer Options #1 • web server • database

    • template engine • test framework • front-end framework
  5. Bootstrapping Rails Composer Options #2 • email setup • authentication

    • authorization • environment variables • deployment
  6. Three Steps to Heaven • rails new bookapp -m composer.rb

    • cd bookapp • thin start Eddie Ochran, 1960: Three Steps to Heaven Bootstrapping
  7. 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
  8. Action Controller Again, smart conventions • naming conventions • methods

    & actions • parameters • sessions & cookies • XML & JSON data
  9. Action View Browser UI • controllers render views • layouts:

    yield & content_for • assets and partials • form helpers
  10. Asset Pipeline What is the Asset Pipeline? • concatenate JS/CSS

    • development vs production • organize application assets • package assets with a gem
  11. Deployment Deploying Rails applications is easy • automate with capistrano

    • Heroku • Digital Ocean • Amazon Web Services
  12. Configuring Rails Adjust application behaviour • Initializer files • ORM

    configs • Rails environments • Internationalization (I18n)
  13. Rails on Rack Rails integration with Rack • rack.github.io •

    active admin • resque web interface • comfortable mexican sofa
  14. 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
  15. Resources #2 Manning Ruby Guides Planet Ruby on Rails Stackoverflow

    RailsBridge O'Reilly Rails Tutorial Avdi's Ruby Tapas rails / rails Pragmatic
  16. 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