· 1 min read

Screencast: Rails 3 mit Rack

Download:

Download(12.1 MB, 8:48) Alternativer Download für iPod & Apple TV(12 MB, 8:48)

Resourcen:

Quellcode:

[ruby] # routes.rb root :to => “home#index” root :to => HomeController.action(:index) root :to => HomeApp

match “/about” => redirect(“/aboutus”) match “/aboutus” => “info#about”

resources :products match “/p/:id” => redirect(“/products/%{id}”)

match “/processes” => ProcessesApp.action(:index)

# Gemfile gem “sinatra”

# lib/home_app.rb class HomeApp < Sinatra::Base get ”/” do “Hello from Sinatra!” end end

# lib/processes_app.rb class ProcessesApp < ActionController::Metal include ActionController::Rendering append_view_path ”#{Rails.root}/app/views” def index @processes = `ps -axcr -o “pid,pcpu,pmem,time,comm”` render end end [/ruby]

[html]

Processes

<%= @processes %>
[/html]

Back to Blog