Skip to content

Conversation

@kleintom
Copy link
Contributor

We used to 500. The error is that when the identifier has no numeric part, like 'asdf' say, then the increment returns the boolean false as the value of the Identifier#identifier, which causes an exception, which gets caught in the clone transaction, which then returns nil (not a).

Exception report:

A NoMethodError occurred in collecting_events#clone:

  undefined method 'persisted?' for nil
  app/controllers/collecting_events_controller.rb:61:in 'block in CollectingEventsController#clone'

-------------------------------
Github link:
-------------------------------

  https://github.com/SpeciesFileGroup/taxonworks/blob/2605ba088/app/controllers/collecting_events_controller.rb#L61

-------------------------------
Request:
-------------------------------

  * URL        : https://sandwich.taxonworks.org/collecting_events/1252283/clone
  * HTTP Method: POST
  * IP address : 147.219.179.95
  * Parameters : {"annotations" => true, "incremented_identifier_id" => 6298365, "controller" => "collecting_events", "action" => "clone", "id" => "1252283", "collecting_event" => {}}

We used to 500. The error is that when the identifier has no numeric part, like 'asdf' say, then the increment returns the boolean `false` as the value of the Identifier#identifier, which causes an exception, which gets caught in the clone transaction, which then returns `nil` (*not* `a`).

Exception report:
```
A NoMethodError occurred in collecting_events#clone:

  undefined method 'persisted?' for nil
  app/controllers/collecting_events_controller.rb:61:in 'block in CollectingEventsController#clone'

-------------------------------
Github link:
-------------------------------

  https://github.com/SpeciesFileGroup/taxonworks/blob/2605ba088/app/controllers/collecting_events_controller.rb#L61

-------------------------------
Request:
-------------------------------

  * URL        : https://sandwich.taxonworks.org/collecting_events/1252283/clone
  * HTTP Method: POST
  * IP address : 147.219.179.95
  * Parameters : {"annotations" => true, "incremented_identifier_id" => 6298365, "controller" => "collecting_events", "action" => "clone", "id" => "1252283", "collecting_event" => {}}

```
@kleintom kleintom requested a review from mjy October 25, 2025 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant