Closed clemens1483 closed 1 year ago
Why was this closed? This is broken in rails 7, where Money raises if passed a lambda with an unloaded model. Money seems to call the lambda too early.
it sat without someone submitting a PR for over a year. if it is important, someone will reopen with a PR to fix it.
Maybe though the feature should be removed from the readme, when there is no test and it doesn't work?
It seems like the issue is here: https://github.com/RubyMoney/money-rails/blob/93d2ee4ff610e85e89bd593923f0633ae974e66e/lib/money-rails/configuration.rb#L38 when determining the iso code, the config setter immediately evaluates the lambda, but in new rails world that isn't working.
I'm happy to make a PR to warn that this is unsupported in Rails 7, or to propose a fix, if you have an idea how to do so.
we would welcome a PR the warns RE: Rails 7
Version:
1.14.0
Rails:6.0.4
Hi, I am getting the rails 6 autoload deprecation warning
When I am using a model in a lambda in
config.default_currency
:Currently the only work around I have found is to wrap the configure block in a
ActiveSupport::Reloader.to_prepare
block which is not ideal. From what I understand wrapping a class in a lambda in an initializer should usually not trigger the deprecation warning as the class is not loaded at that point unless the gem calls the lambda on initialization.