PecanProject / bety

Web-interface to the Biofuel Ecophysiological Traits and Yields Database (used by PEcAn and TERRA REF)
https://www.betydb.org
BSD 3-Clause "New" or "Revised" License
16 stars 38 forks source link

Yields with no assigned creator (user_id) are not updatable. #495

Closed gsrohde closed 7 years ago

gsrohde commented 7 years ago

When yields are created via the BETYdb Rails app, the user_id is automatically set to the logged-in user. But there are existing rows in the yields table with null user_id. If one tries to update such a row via the Rails app, the app won't allow it and will complain that a user hasn't been assigned.

Options for fixing: (1) allow user_id to remain null if the row is being updated; (2) automatically assign the user doing the updating as the user _if (and only if) the row being updated has null user_id_.

dlebauer commented 7 years ago

I like 2 ; automatically assign the user doing the updating as the user if (and only if) the row being updated has null user_id.

Does this happen to the traits table as well?

gsrohde commented 7 years ago

No, it doesn't happen with the traits table. Updating a trait with null user_id leaves it null (option 1).