lib/uploadcare/rails/engine.rb in uploadcare-rails-1.2.1 vs lib/uploadcare/rails/engine.rb in uploadcare-rails-2.0.0

- old
+ new

@@ -1,29 +1,25 @@ +# frozen_string_literal: true + require 'rails/engine' -require 'uploadcare/rails/settings' module Uploadcare module Rails + # Rails engine that allows to extend default rails libraries class Engine < ::Rails::Engine initializer 'uploadcare-rails.load' do - # load actual rails extentions - # active record extention for stand-alone file models and models has files - - ActiveSupport.on_load :active_record do - require 'uploadcare/rails/active_record/has_file' - require 'uploadcare/rails/active_record/has_group' + # Load extensions + # Extend action_view with widget_tag + ActiveSupport.on_load :action_view do + require 'uploadcare/rails/action_view/uploadcare_include_tags' + require 'uploadcare/rails/action_view/uploadcare_uploader_tags' end - # JS options, widets from cdn etc - ActiveSupport.on_load :action_view do - require 'uploadcare/rails/action_view/include_tags' - require 'uploadcare/rails/action_view/uploader_tags' - - # Simple Form helpers - require 'uploadcare/rails/simple_form/simple_form' if defined?(SimpleForm) - - # Formastic helpers - require 'uploadcare/rails/formtastic/formtastic' if defined?(Formtastic) + # Load extensions for active_record + # Extend active_record with mount_uploadcare_file and mount_uploadcare_file_group methods + ActiveSupport.on_load :active_record do + require 'uploadcare/rails/active_record/mount_uploadcare_file' + require 'uploadcare/rails/active_record/mount_uploadcare_file_group' end end end end end