Rails Metal Screencast by RailsCasts

by Melvin Ram

I just got done watching the screencast on Rails Metal by RailsCasts and I took some notes:

Rails Casts Notes: #150 Rails Metal

  • Bypass rails routing
  • Simple request that happens frequently.
  • to generate: ruby script/generate metal name_of_metal
  • stored under app/metal/
  • in the generated code, the self.call(env) method should return an array.
    1. response code ex. 404 or 200
    2. hash of header options
    3. Body content
  • Won’t be recorded in log file since it bypass that as well.
  • When creating/changing a metal, you need to restart server
  • If there is a conflict between Rails routing and metal, metal wins because it gets the request before rails has had a chance to process it.
  • “ab -n 100 http://127.0.0.1:3000/processes/list” will run a benchmark that you can use to compare performance (just replace the url of page)

Leave a Comment