seek4science / seek

For finding, sharing and exchanging Data, Models, Simulations and Processes in Science.
http://www.seek4science.org
BSD 3-Clause "New" or "Revised" License
77 stars 52 forks source link

undefined method `label' for nil:NilClass in method `seek_cv_attribute_display` #2002

Closed kdp-cloud closed 1 month ago

kdp-cloud commented 1 month ago

When sample routes are accessed, this error is thrown:

An ActionView::Template::Error occurred in samples#show:

  undefined method `label' for nil:NilClass

      term.label
          ^^^^^^
  app/helpers/samples_helper.rb:185:in `seek_cv_attribute_display'

Probably caused by: https://github.com/seek4science/seek/blob/41337acfefd729435f4329eda12fe428459b433a/app/helpers/samples_helper.rb#L177-L187

whomingbird commented 1 month ago

is this bug fix related to your probelm? https://github.com/seek4science/seek/commit/b8d0d35978c7bd68e16a814750901fca27d79645

kdp-cloud commented 1 month ago

@whomingbird The error seems to occur when free text in a controlled vocabulary is allowed. In that case term resolves to Nil and raises an exception.

If free text is allowed, it should simply return the value. What do you think?