Passenger ignores RailsEnv directive for Rails 3 applications
You might find that your Passenger ignores all RailsSomething
directives in the vhost for your new Rails 3 application. The culprit is a file config.ru
which makes Passenger consider your application a Rack (non-Rails) application.
To fix this you can either use RackEnv
in lieu of RailsEnv
(it works fine) or delete the config.ru
. Unless you have a good reason to do so, go with RackEnv
.
Related cards:
Passenger booting Rails 3 application in wrong environment
Passenger gives you the possibility to define in which environment your app should be started.
This has to be added to the VirtualHost configuration for Apache for Rails 2 applications:
RailsEnv development
When running Rails 3, you need
...
Fix LoadError with Rails 3 applications on Passenger
After switching to Rails 3 you may get a LoadError
with the following message when trying to use your application via passenger:
no such file to load -- dispatcher
Your Passenger version is most likely out of date.
Update the gem, then ins...
Security issues with hash conditions in Rails 2 and Rails 3
Find conditions for scopes can be given either as an array (:conditions => ['state = ?', 'draft']
) or a hash (:conditions => { 'state' => 'draft' }
). The later is nicer to read, but has horrible security implications in some versions of Ru...
Upgrade guide for moving a Rails app from Webpack 3 to Webpack 4
Webpacker is Rails' way of integrating Webpack, and version 4 has been released just a few days ago, allowing us to use Webpack 4.
I successfully upgraded an existing real-world Webpack 3 application. Below are notes on everything that I encounte...
Use different code for Rails 2 and Rails 3
When writing a piece of reusable code, you sometimes need to have separate code for Rails 2 and Rails 3. You can distinguish between Rails versions like this:
if Rails.version < '3' # mind the quotes
# Rails 2 code goes here
else
...
Generating an Entity Relationship Diagram for your Rails application
This card explains how to generate an entity relationship diagram for your Rails application.
We also show how to limit your ERD to a subset of models, e.g. models inside a namespace.
Generating a full ERD
Option A: RubyMine
- Right-cli...
Rails 3 issue: update_all ignores conditions, when :orders and :limit options are supplied
Leads to awesomeness and unicorns when used in production.
See which Rails applications are being served by your Passenger
To obtain a list of Passenger processes with their application directories and memory usages, you can say
sudo passenger-memory-stats
This will output a list like this:
----- Passenger processes -----
PID VMSize Private Name
...
Let a Rails 3 application make a request to itself
Ever wondered how Rails talks to itself in a Cucumber feature? In Rails 3 you can do it like this:
def rack_env(path)
{ "rack.input" => {},
"PATH_INFO"=>"#{path}",
"REQUEST_METHOD"=>"GET" }
end
request = rack_en...