umts / incidents

Operator incident report tracking for the Springfield and Valley Area Transit Companies
MIT License
1 stars 1 forks source link

Rails Validations for Fields #169

Open mboneil10 opened 6 years ago

mboneil10 commented 6 years ago

Liza suggested that we validate maximum length for the "vehicle damage area" (incident_report_damage_to_bus_x). I'll try to see if there's anything else we should add validations to in the fields.

dfaulken commented 6 years ago

How would you propose to implement this?

mboneil10 commented 6 years ago

There's an ActiveRecord::ValueTooLong error. Hm. I thought that the user wouldn't have to see the actual error and could get a more reasonable error message.

Anbranin commented 6 years ago

to add it to object.errors.full_messages (because I'm assuming that goes in the flash on your page), you can do a model validation right?

dfaulken commented 6 years ago

How will you apply that Rails validation to only one field?

Anbranin commented 6 years ago

Custom validations. Not saying it's the best way, but it's certainly possible.

dfaulken commented 6 years ago

I'm still not sure what you mean. I mean at the code level - given that fields are database objects in the new design - what code or pseudocode would we plan to write to apply validations based on individual database objects?

dfaulken commented 5 years ago

I think when I wrote my comment above, I was confused and thought we were talking about a different app. It can be disregarded.

However I'm not sure of what the 'maximum length' is being validated here. If there isn't a real business request or technical concern involved, I'd recommend closing this issue.

sherson commented 4 years ago

We should ask Liza what specifically she meant by this, and if it's still needed.

avacmeyer commented 4 years ago
Screen Shot 2020-08-13 at 10 44 57 AM

I can add a maximum length to the text field.