Hackily fix the Rails 3 routing errors we were seeing in 3.0.11.

Closes gh-194
This commit is contained in:
Nathan Weizenbaum 2010-06-10 13:31:48 -07:00
parent d2dd0e52c2
commit 0a35cff21f
3 changed files with 27 additions and 2 deletions

View File

@ -3,6 +3,14 @@
* Table of contents * Table of contents
{:toc} {:toc}
## 3.0.12 (Unreleased)
## Rails 3 Support
Apparently the last version broke in new and exciting ways under Rails 3,
due to the inconsistent load order caused by certain combinations of gems.
3.0.12 hacks around that inconsistency, and *should* be fully Rails 3-compatible.
## 3.0.11 ## 3.0.11
[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.11). [Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.11).

View File

@ -3,6 +3,14 @@
* Table of contents * Table of contents
{:toc} {:toc}
## 3.0.12 (Unreleased)
## Rails 3 Support
Apparently the last version broke in new and exciting ways under Rails 3,
due to the inconsistent load order caused by certain combinations of gems.
3.0.12 hacks around that inconsistency, and *should* be fully Rails 3-compatible.
## 3.0.11 ## 3.0.11
[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.11). [Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.11).

View File

@ -12,8 +12,17 @@ unless defined?(Sass::RAILS_LOADED)
if defined?(ActionController::Metal) if defined?(ActionController::Metal)
# Rails >= 3.0 # Rails >= 3.0
require 'sass/plugin/rack' require 'sass/plugin/rack'
Rails.application.instance_variable_set('@app', if Rails.application.instance_variable_get('@app')
Sass::Plugin::Rack.new(Rails.application.app)) # The application has already been built,
# so we need to hack the middleware in
Rails.application.instance_variable_set('@app',
Sass::Plugin::Rack.new(Rails.application.app))
else
# The application hasn't been built yet,
# so we can just add Sass::Plugin::Rack
# to the pending middleware stack.
Rails.configuration.middleware.use(Sass::Plugin::Rack)
end
elsif defined?(ActionController::Dispatcher) && elsif defined?(ActionController::Dispatcher) &&
defined?(ActionController::Dispatcher.middleware) defined?(ActionController::Dispatcher.middleware)
# Rails >= 2.3 # Rails >= 2.3