Skip to content
  • George Claghorn's avatar
    03afddd2
    Fix that models can clobber each others' attachment reflections · 03afddd2
    George Claghorn authored
    Consider the following model definitions:
    
        class User < ApplicationRecord
          has_one_attached :avatar
        end
    
        class Group < ApplicationRecord
          has_one_attached :avatar
        end
    
    If you attempt to reflect on the User model's avatar attachment via User.reflect_on_attachment, you could receive a reflection for the Group model's avatar attachment. Fix this by ensuring that each model class uses its own Hash object to track attachment reflections.
    03afddd2
    Fix that models can clobber each others' attachment reflections
    George Claghorn authored
    Consider the following model definitions:
    
        class User < ApplicationRecord
          has_one_attached :avatar
        end
    
        class Group < ApplicationRecord
          has_one_attached :avatar
        end
    
    If you attempt to reflect on the User model's avatar attachment via User.reflect_on_attachment, you could receive a reflection for the Group model's avatar attachment. Fix this by ensuring that each model class uses its own Hash object to track attachment reflections.
Loading