From 8c512b49acca713c2e9374f5377c17e7c475c764 Mon Sep 17 00:00:00 2001 From: Daniel Neighman Date: Thu, 11 Mar 2010 23:27:43 +1300 Subject: [PATCH 1/3] Adds a railtie for Rails 3 compatibility --- lib/haml.rb | 1 + lib/haml/railtie.rb | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 lib/haml/railtie.rb diff --git a/lib/haml.rb b/lib/haml.rb index 6dbc5ff5..b5213b9c 100644 --- a/lib/haml.rb +++ b/lib/haml.rb @@ -38,3 +38,4 @@ end require 'haml/util' require 'haml/engine' +require 'haml/railtie' diff --git a/lib/haml/railtie.rb b/lib/haml/railtie.rb new file mode 100644 index 00000000..8d2df1f5 --- /dev/null +++ b/lib/haml/railtie.rb @@ -0,0 +1,9 @@ +if defined?(Rails::Railtie) + module Haml + class Railtie < Rails::Railtie + initializer :haml do + Haml.init_rails(binding) + end + end + end +end From cb98a114f8bb316faa38b42b228b835f50a91271 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Sun, 14 Mar 2010 17:15:33 -0700 Subject: [PATCH 2/3] Add a note about when to remove the railtie. --- lib/haml/railtie.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/haml/railtie.rb b/lib/haml/railtie.rb index 8d2df1f5..6fe4d9a4 100644 --- a/lib/haml/railtie.rb +++ b/lib/haml/railtie.rb @@ -1,3 +1,8 @@ +# This file is here to integrate with Rails 3, +# since there's no better way to do so as of 14 March 2010. +# Yehuda promises there will be soon, +# and once there is we should switch to that. + if defined?(Rails::Railtie) module Haml class Railtie < Rails::Railtie From 13c86b8ac0eb2670f1a0bee563f42412b3b1fa2f Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Sun, 14 Mar 2010 17:19:26 -0700 Subject: [PATCH 3/3] Add changelog entries about the railtie. --- doc-src/HAML_CHANGELOG.md | 5 +++++ doc-src/SASS_CHANGELOG.md | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/doc-src/HAML_CHANGELOG.md b/doc-src/HAML_CHANGELOG.md index 1e7f1889..bbf5d609 100644 --- a/doc-src/HAML_CHANGELOG.md +++ b/doc-src/HAML_CHANGELOG.md @@ -3,6 +3,11 @@ * Table of contents {:toc} +## 2.2.22 (Unreleased) + +* Add a railtie so Haml and Sass will be automatically loaded in Rails 3. + Thanks to [Daniel Neighman](http://pancakestacks.wordpress.com/). + ## 2.2.21 [Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.21). diff --git a/doc-src/SASS_CHANGELOG.md b/doc-src/SASS_CHANGELOG.md index bae23709..c3038f57 100644 --- a/doc-src/SASS_CHANGELOG.md +++ b/doc-src/SASS_CHANGELOG.md @@ -3,6 +3,11 @@ * Table of contents {:toc} +## 2.2.22 (Unreleased) + +* Add a railtie so Haml and Sass will be automatically loaded in Rails 3. + Thanks to [Daniel Neighman](http://pancakestacks.wordpress.com/). + ## 2.2.21 [Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.21).