Fix: Preserve Scientific Name Attributes on Crop Edit#4379
Fix: Preserve Scientific Name Attributes on Crop Edit#4379google-labs-jules[bot] wants to merge 1 commit intodevfrom
Conversation
When editing a crop, the `recreate_names` method in the `CropsController` would always destroy and recreate the associated scientific names, even if they had not changed. This caused any additional attributes on the scientific names to be lost. This commit modifies `recreate_names` to first check if the submitted names are different from the existing ones. If they are the same, the method returns early, preserving the existing records and their attributes. Additionally, this commit corrects a typo in `crop_params` where `:scientific_name` was used instead of `:name` for the nested attributes, ensuring that the parameters are permitted correctly.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
This change fixes a bug where editing a crop would remove attributes from the scientific names on save, if the names did not change. It also includes a minor correction to the strong parameters for crops.
PR created automatically by Jules for task 17495138204485954744 started by @CloCkWeRX