Skip to content

Commit

Permalink
duplicated readonly_attributes for each inherited class
Browse files Browse the repository at this point in the history
  • Loading branch information
DarshanaVenkatesh committed Dec 11, 2024
1 parent c6f9073 commit 96cbea8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/mongoid/attributes/readonly.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ module Readonly
extend ActiveSupport::Concern

included do
class_attribute :readonly_attributes
class_attribute :readonly_attributes, instance_writer: false, instance_reader: false
self.readonly_attributes = ::Set.new
def self.inherited(subclass)
super
subclass.readonly_attributes = readonly_attributes.dup
end
end

# Are we able to write the attribute with the provided name?
Expand Down Expand Up @@ -71,4 +75,4 @@ def attr_readonly(*names)
end
end
end
end
end

0 comments on commit 96cbea8

Please sign in to comment.