I run the Thin webserver for basically every app in my dev/test environments. When I used Mongrel with Rails 2.x, all I had to type was script/server
to get it to run the webserver I choose. But with Rails 3, I have to specify Thin every time. Is there a way to get Thin running on my Rails apps by just typing rails s
instead of rails s thin
?
相关问题
- Question marks after images and js/css files in ra
- Using :remote => true with hover event
- Eager-loading association count with Arel (Rails 3
- How to specify memcache server to Rack::Session::M
- Why am I getting a “C compiler cannot create execu
相关文章
- Ruby using wrong version of openssl
- Right way to deploy Rails + Puma + Postgres app to
- AWS S3 in rails - how to set the s3_signature_vers
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- How to add a JSON column in MySQL with Rails 5 Mig
- “No explicit conversion of Symbol into String” for
- form_for wrong number of arguments in rails 4
Simply install thin, cd to the directory that your app is in and run thin start. Works perfectly here. :)
You can use http://www.softiesonrails.com/2008/4/27/using-thin-instead-of-mongrel to change as needed. (Its the one I used)
In
script/rails
the following works as well:As of Rails 3.2rc2, thin is now run by default on invoking
rails server
whengem 'thin'
is in your Gemfile! Thanks to this pull request: https://github.com/rack/rack/commit/b487f02b13f42c5933aa42193ed4e1c0b90382d7Works great for me.
Yeah it's possible to do this.
The way the
rails s
command works at the end of the day is by falling through to Rack and letting it pick the server. By default the Rack handler will try to usemongrel
and if it can't find mongrel it will go withwebrick
. All we have to do is patch the handler slightly. We'll need to insert our patch into therails
script itself. Here is what you do, crack open yourscript/rails
file. By default it should look like this:We insert our patch right before the
require 'rails/commands'
line. Our new file should look like this:Notice that it will now try Mongrel and if there is an error try for Thin and only then go with Webrick. Now when you type
rails s
we get the behaviour we're after.