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

Best Rails Book You've Never Read

Best Rails Book You've Never Read

A presentation on all the benefits you gain after reading Rebuilding Rails by Noah Gibbs.

DamirSvrtan

June 23, 2016
Tweet

More Decks by DamirSvrtan

Other Decks in Programming

Transcript

  1. WELL KNOWN BOOKS POODR Sandi Metz RoR Tutorial Michael Hartl

    Pickaxe David Thomas Metaprogramming Ruby Paolo Perrotta
  2. # config.ru require 'rack' class MyApp def call(env) [200, {

    'Content-Type' => 'text/html' }, ["Hello World"]] end end run MyApp.new
  3. # config.ru require 'rack' class MyApp def call(env) [200, {

    'Content-Type' => 'text/html' }, ["Hello World"]] end end run MyApp.new
  4. { "SERVER_SOFTWARE"=>"THIN 1.6.3 CODENAME PROTEIN POWDER", "SERVER_NAME"=>"LOCALHOST", "RACK.INPUT"=>#<STRINGIO:0X007FFD50C4A9C8>, "RACK.VERSION"=>[1, 0],

    "RACK.ERRORS"=>#<IO:<STDERR→, "RACK.MULTITHREAD"=>FALSE, "RACK.MULTIPROCESS"=>FALSE, "RACK.RUN_ONCE"=>FALSE, "REQUEST_METHOD"=>"GET", "REQUEST_PATH"=>"/", "PATH_INFO"=>"/", "REQUEST_URI"=>"/", "HTTP_VERSION"=>"HTTP/1.1", "HTTP_HOST"=>"LOCALHOST:3000", "HTTP_CONNECTION"=>"KEEP-ALIVE", "HTTP_CACHE_CONTROL"=>"MAX-AGE=0", "HTTP_UPGRADE_INSECURE_REQUESTS"=>"1", "HTTP_USER_AGENT"=>"MOZILLA/5.0 (MACINTOSH; INTEL MAC OS X 10_11_3) APPLEWEBKIT/537.36 (KH™L, LIKE GECKO) CHROME/51.0.2704.103 SAFARI/537.36", "HTTP_ACCEPT"=>"TEXT/H™L,APPLICATION/XH™L+XML,APPLICATION/XML;Q=0.9,IMAGE/WEBP,*/*;Q=0.8", "HTTP_ACCEPT_ENCODING"=>"GZIP, DEFLATE, SDCH", "HTTP_ACCEPT_LANGUAGE"=>"EN-US,EN;Q=0.8", "HTTP_COOKIE"=> "", "GATEWAY_INTERFACE"=>"CGI/1.2", "SERVER_PORT"=>"3000", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "RACK.URL_SCHEME"=>"HTTP", "SCRIPT_NAME"=>"", "REMOTE_ADDR"=>"127.0.0.1" }
  5. # config.ru require 'rack' class MyApp def call(env) [200, {

    'Content-Type' => 'text/html' }, ["Hello World"]] end end run MyApp.new
  6. use Rack::Session::Cookie, :secret => 'abc123' use BetterErrors::Middleware if Noodles.env.development? use

    Rack::CommonLogger, $stdout use Rack::ContentType use Rack::MethodOverride use Rack::Static, urls: ["/css", "/images", "/js", "/favicon.ico"], root: "public" run Noodles.application
  7. Noodles.http_app.routes do root_to 'home#index' get 'chat', 'chat#index' get "auth/:provider/callback", 'session#success'

    get "auth/failure", 'session#failure' post "rooms", "rooms#create" delete "logout", 'session#logout' resources :users end
  8. class UsersController < ApplicationController def index unless request.cookies[:favorite_color] == :black

    response.headers.push('Set-Cookie', 'favorite_color=black') end end end
  9. Any questions? [email protected] @DAMIRSVRTAN Visit infinum.co or find us on

    social networks: infinum.co infinumco infinumco infinum