lib/avo/base_resource.rb in avo-2.35.0 vs lib/avo/base_resource.rb in avo-2.36.0

- old
+ new

@@ -149,12 +149,13 @@ end def record @model end - alias :model :record + alias_method :model, :record + def hydrate(model: nil, view: nil, user: nil, params: nil) @view = view if view.present? @user = user if user.present? @params = params if params.present? @@ -305,20 +306,22 @@ get_field_definitions.select do |field| [Avo::Fields::FileField, Avo::Fields::FilesField].include? field.class end end - def fill_model(model, params, extra_params: []) - # Map the received params to their actual fields - fields_by_database_id = get_field_definitions + # Map the received params to their actual fields. + def fields_by_database_id + get_field_definitions .reject do |field| field.computed end .map do |field| [field.database_id.to_s, field] end .to_h + end + def fill_model(model, params, extra_params: []) # Write the field values params.each do |key, value| field = fields_by_database_id[key] next unless field.present?