-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some form data persisting [""]
instead of []
for blank entries
#807
Comments
Issue seems to be happening here. @sjproctor to attach screenshot of params. Form looks as expected before this point. it issue can be see after evaluating 'action', here. "" values should be nil. [ " " ] values should be [ ] Sarah has a bandaid in place for now but we still need to figure this out because anyone editing/creating a record from the frontend will introduce bad data in the system. until we can figure out the WHY, maybe we need to clean the params? #psuedocode
def clean_params(params)
params.each do |key, value|
if value.is_a?(ActionController::Parameters)
clean_params(value) # Recursively clean nested hashes
elsif value.is_a?(Array)
params[key] = value == [""] ? [] : value # Convert [""] to []
else
params[key] = value.empty? ? nil : value # Convert "" to nil
end
end
end
# Call the method on your params
clean_params(params) |
[""]
instead of []
for blank entries[""]
instead of []
for blank entries
In Hyrax the params also get populated with |
This problem is being addressed in #771 |
Summary
Data fields that appear blank are rendering on the works show page. This is because at some point during form submission some attributes get assigned
[""]
if there is no data.The commit
17489e60223a00d62b36525adc66c09ce1fa630a
on Adventist Knapsack provided a temporary solution for the client.The fields are:
Acceptance Criteria
Testing Instructions
app/renderers/hyrax/renderers/attribute_renderer.rb
fromreturn markup if Array.wrap(values).first.blank? && !options[:include_empty]
toreturn markup if values.blank? && !options[:include_empty]
Notes
This appears to happen most often on data values.
Ref: #771
The text was updated successfully, but these errors were encountered: