lib/rails/generators/opal/assets/assets_generator.rb in opal-rails-0.7.0.beta2 vs lib/rails/generators/opal/assets/assets_generator.rb in opal-rails-0.7.0
- old
+ new
@@ -6,15 +6,17 @@
class AssetsGenerator < ::Rails::Generators::NamedBase
include ::Rails::Generators::ResourceHelpers
source_root __dir__+'/templates'
def initialize(*args)
- ::Rails::Generators::ModelHelpers.skip_warn = true
+
+ module_name = ::Rails::Generators.const_defined?('ModelHelpers') ? 'ModelHelpers' : 'ResourceHelpers'
+ ::Rails::Generators.const_get(module_name).skip_warn = true
super
end
def copy_opal
- template 'javascript.js.rb', File.join('app/assets/javascripts', class_path, "#{file_name}_view.js.rb")
+ template 'javascript.js.rb', File.join('app/assets/javascripts', class_path, "#{controller_name}_view.js.rb")
end
end
end
end