app/forms/hyrax/forms/resource_form.rb in hyrax-4.0.0.rc1 vs app/forms/hyrax/forms/resource_form.rb in hyrax-4.0.0.rc2

- old
+ new

@@ -35,11 +35,11 @@ # # This form wraps +Hyrax::ChangeSet+ in the +HydraEditor::Form+ interface. class ResourceForm < Hyrax::ChangeSet # rubocop:disable Metrics/ClassLength ## # @api private - InWorksPrepopulator = lambda do |_options| + InWorksPrepopulator = proc do |_options| self.in_works_ids = if persisted? Hyrax.query_service .find_inverse_references_by(resource: model, property: :member_ids) .select(&:work?) @@ -54,11 +54,11 @@ # # @note includes special handling for Wings, to support compatibility # with `etag`-driven, application-side lock checks. for non-wings adapters # we want to move away from application side lock validation and rely # on the adapter/database features instead. - LockKeyPrepopulator = lambda do |_options| + LockKeyPrepopulator = proc do |_options| if Hyrax.config.disable_wings || !Hyrax.metadata_adapter.is_a?(Wings::Valkyrie::MetadataAdapter) Hyrax.logger.info "trying to prepopulate a lock token for " \ "#{self.class.inspect}, but optimistic locking isn't " \ "supported for the configured adapter: #{Hyrax.metadata_adapter.class}" self.version = '' @@ -76,29 +76,29 @@ property :visibility, default: VisibilityIntention::PRIVATE, populator: :visibility_populator property :date_modified, readable: false property :date_uploaded, readable: false - property :agreement_accepted, virtual: true, default: false, prepopulator: ->(_opts) { self.agreement_accepted = !model.new_record } + property :agreement_accepted, virtual: true, default: false, prepopulator: proc { |_opts| self.agreement_accepted = !model.new_record } collection(:permissions, virtual: true, default: [], form: Hyrax::Forms::Permission, populator: :permission_populator, - prepopulator: ->(_opts) { self.permissions = Hyrax::AccessControl.for(resource: model).permissions }) + prepopulator: proc { |_opts| self.permissions = Hyrax::AccessControl.for(resource: model).permissions }) property :embargo, form: Hyrax::Forms::Embargo, populator: :embargo_populator property :lease, form: Hyrax::Forms::Lease, populator: :lease_populator # virtual properties for embargo/lease; - property :embargo_release_date, virtual: true, prepopulator: ->(_opts) { self.embargo_release_date = model.embargo&.embargo_release_date } - property :visibility_after_embargo, virtual: true, prepopulator: ->(_opts) { self.visibility_after_embargo = model.embargo&.visibility_after_embargo } - property :visibility_during_embargo, virtual: true, prepopulator: ->(_opts) { self.visibility_during_embargo = model.embargo&.visibility_during_embargo } + property :embargo_release_date, virtual: true, prepopulator: proc { |_opts| self.embargo_release_date = model.embargo&.embargo_release_date } + property :visibility_after_embargo, virtual: true, prepopulator: proc { |_opts| self.visibility_after_embargo = model.embargo&.visibility_after_embargo } + property :visibility_during_embargo, virtual: true, prepopulator: proc { |_opts| self.visibility_during_embargo = model.embargo&.visibility_during_embargo } - property :lease_expiration_date, virtual: true, prepopulator: ->(_opts) { self.lease_expiration_date = model.lease&.lease_expiration_date } - property :visibility_after_lease, virtual: true, prepopulator: ->(_opts) { self.visibility_after_lease = model.lease&.visibility_after_lease } - property :visibility_during_lease, virtual: true, prepopulator: ->(_opts) { self.visibility_during_lease = model.lease&.visibility_during_lease } + property :lease_expiration_date, virtual: true, prepopulator: proc { |_opts| self.lease_expiration_date = model.lease&.lease_expiration_date } + property :visibility_after_lease, virtual: true, prepopulator: proc { |_opts| self.visibility_after_lease = model.lease&.visibility_after_lease } + property :visibility_during_lease, virtual: true, prepopulator: proc { |_opts| self.visibility_during_lease = model.lease&.visibility_during_lease } property :in_works_ids, virtual: true, prepopulator: InWorksPrepopulator # provide a lock token for optimistic locking; we name this `version` for # backwards compatibility