Closed kingcons closed 9 years ago
When you set up a validation is there a way to link in another table with codes in it and validate the field by ensuring that a valid code is used? For example: 4DSN for 4 door sedan. Then make sure they don't try to enter something like SN4D.
@ddeckard72 come talk to me or brit! If you're talking about a route, you don't really control what they input, but you can return an error or a 404 page based on a validation in your controller method. You can ensure that their parameter is in an array of results that you could pull from your database model.
if you're talking about a model, you can write a method on your model that returns an array from your validation_table
and make sure your attribute can't be saved unless its in that array.
Description
Submission
Post a question about the Review Document or the routing guide in the comments of this issue.