-
-
Save larsthegeek/52e1a8bdfbc8b9e8fbe4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/config/boot.rb b/config/boot.rb | |
index 69b1a51..2c979cf 100644 | |
--- a/config/boot.rb | |
+++ b/config/boot.rb | |
@@ -61,12 +61,30 @@ module Rails | |
require 'initializer' | |
end | |
+ def monkeypatch_helpers | |
+ require "active_support" | |
+ require 'action_controller/helpers' | |
+ ActionController::Helpers::ClassMethods.send(:define_method, :inherited_with_helper) do |child| | |
+ inherited_without_helper(child) | |
+ | |
+ begin | |
+ child.master_helper_module = Module.new | |
+ child.master_helper_module.__send__ :include, master_helper_module | |
+ child.__send__ :default_helper_module! | |
+ rescue MissingSourceFile => e | |
+ raise unless e.is_missing?("helpers/#{child.controller_path}_helper") | |
+ rescue LoadError | |
+ end | |
+ end | |
+ end | |
+ | |
def load_rails_gem | |
if version = self.class.gem_version | |
gem 'rails', version | |
else | |
gem 'rails' | |
end | |
+ monkeypatch_helpers | |
rescue Gem::LoadError => load_error | |
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment