instance method
update_data_with_schema_defaults
Ruby on Rails edge
Since edge Private — implementation detail, not part of the public APISignature
update_data_with_schema_defaults()
Types that are declared using real values, like true/false, 5, or “hello”, will be used as defaults. Types that are declared using symbols, like :boolean, :integer, :string, will be nulled out.
Source
# File activemodel/lib/active_model/schematized_json.rb, line 120
def update_data_with_schema_defaults
@data.reverse_merge!(@schema.to_h { |attr, type| [ attr.to_s, type.is_a?(Symbol) ? nil : type ] })
end
Defined in activemodel/lib/active_model/schematized_json.rb line 120
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::SchematizedJson::DataAccessor