lib/jbuilder/railtie.rb in jbuilder-2.2.2 vs lib/jbuilder/railtie.rb in jbuilder-2.2.3
- old
+ new
@@ -1,11 +1,20 @@
require 'rails/railtie'
+require 'jbuilder/jbuilder_template'
class Jbuilder
class Railtie < ::Rails::Railtie
- generators do |app|
- Rails::Generators.configure! app.config.generators
- Rails::Generators.hidden_namespaces.uniq!
- require 'generators/rails/scaffold_controller_generator'
+ initializer :jbuilder do |app|
+ ActiveSupport.on_load :action_view do
+ ActionView::Template.register_template_handler :jbuilder, JbuilderHandler
+ end
end
+
+ if Rails::VERSION::MAJOR == 4
+ generators do |app|
+ Rails::Generators.configure! app.config.generators
+ Rails::Generators.hidden_namespaces.uniq!
+ require 'generators/rails/scaffold_controller_generator'
+ end
+ end
end
-end
\ No newline at end of file
+end