filestack / filestack-rails

Official Ruby on Rails plugin for Filestack File Picker that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.
https://www.filestack.com
Apache License 2.0
223 stars 101 forks source link

FilestackRails::ApplicationHelper, and FilestackRails::FormHelper autoloaded by Rails #230

Closed PhilCoggins closed 3 years ago

PhilCoggins commented 4 years ago

On Rails 6, warnings are thrown during app initialization:

WARN -- : DEPRECATION WARNING: Initialization autoloaded the constants FilestackRails::ApplicationHelper, and FilestackRails::FormHelper.

Being able to do this is deprecated. Autoloading during initialization is going
to be an error condition in future versions of Rails.

Reloading does not reboot the application, and therefore code executed during
initialization does not run again. So, if you reload FilestackRails::ApplicationHelper, for example,
the expected changes won't be reflected in that stale Class object.

`config.autoloader` is set to `classic`. These autoloaded constants would have been unloaded if `config.autoloader` had been set to `:zeitwerk`.

FilestackRails::ApplicationHelper, and FilestackRails::FormHelper are autoloaded by Rails during initialization as there is nothing in the gem requireing those files. I can get around by opening the gem code locally and adding the following to lib/filestack-rails.rb:

require_relative "../app/helpers/filestack_rails/application_helper"
require_relative "../app/helpers/filestack_rails/form_helper"

Would it be possible for you to add something similar so these files can be required before hitting Rails autoloader?

gabifija commented 4 years ago

@PhilCoggins Thanks for your comment. I'll take a look on the case. I'll figure that out soon.

gabifija commented 3 years ago

@PhilCoggins Sorry for the delay. Now it is fixed in 5.3.0.

PhilCoggins commented 3 years ago

@gabifiolek Thank you so much!