Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between rack app vs. rails app?

I uploaded my rails 2.3.8 app to DreamHost and got an error about rack version incompatibility. I issued a support ticket and the service guy recommended that I delete config.ru.

That solved the problem. But I wonder what that would affect.

Is it ok that a rails app goes without config.ru?

like image 693
Sam Kong Avatar asked Jun 03 '11 18:06

Sam Kong


2 Answers

A Rack app is a web app written in Ruby that uses the Rack project. A really simple Hello World config.ru example is like so:

class HelloWorld
  def call(env)
    [200, {'Content-Type' => 'text/plain'}, ['Hello World!']]
  end
end

run HelloWorld.new

Rails 2.3+ uses Rack as the basis for its HTTP handling, but some hosting providers might handle Rails specially and may not support running Rails as a Rack app. That seems to be the case with DreamHost for Rails 2.3.8, at least as you've specified your gem requirements.

like image 71
Brian Donovan Avatar answered Oct 07 '22 01:10

Brian Donovan


you should check those two RailsCasts:

  • http://railscasts.com/episodes/151-rack-middleware
  • http://railscasts.com/episodes/150-rails-metal

  • and perhaps: http://railscasts.com/episodes/222-rack-in-rails-3

like image 32
Tilo Avatar answered Oct 07 '22 01:10

Tilo