-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack level too deep when accessing an ActiveStorage object #131
Comments
The problem is here:
Probably depends on the fact that ActiveStorage::Attachment delegates missing to More in general, Chronomodel has issues when using model with # attachment.rb
class Attachment < ApplicationRecord
belongs_to :blob
delegate_missing_to :blob
end
# blob.rb
class Blob < ApplicationRecord
has_many :attachments
end |
Failing spec bd830d7 |
"Temporary" Workaround: # frozen_string_literal: true
# TODO: Remove me if ifad/chronomodel#131 will be fixed
module ChronoModel
module Patches
module NoChronoRecord
def as_of_time
false
end
end
end
end
Rails.configuration.to_prepare do
ActiveStorage::Attachment.include ChronoModel::Patches::NoChronoRecord
end |
tagliala
added a commit
that referenced
this issue
Jan 22, 2022
Checks if the module `AsOfTimeHolder` is included in the model rather than using `respond_to?` to prevent stack overflow when a model delegates missing methods to an association. Fix #131
tagliala
added a commit
that referenced
this issue
Jan 22, 2022
Checks if the module `AsOfTimeHolder` is included in the model rather than using `respond_to?` to prevent stack overflow when a model delegates missing methods to an association. Fix #131
tagliala
added a commit
that referenced
this issue
Jan 22, 2022
Checks if the module `AsOfTimeHolder` is included in the model rather than using `respond_to?` to prevent stack overflow when a model delegates missing methods to an association. Fix #131
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ruby: 3.0.3/2.7.5
Rails: 7.0.1/6.1.4.4
Reproducible test case at https://github.com/diowa/ruby3-rails6-bootstrap-heroku/tree/active-storage-chronomodel
Relevant commit: diowa/ruby3-rails6-bootstrap-heroku@9211ff2
Before
After
😊😊😊
The text was updated successfully, but these errors were encountered: