TIY-ATL-ROR-2015-Sep / assignments

0 stars 0 forks source link

HW 10-26 #358

Closed kingcons closed 9 years ago

kingcons commented 9 years ago

Description

  1. Read Chapter 1 of the Rails Routing guide.
  2. Read at least through week 4 of the Week 6 Recap.
  3. Polish and work on any incomplete assignments.

    Submission

Post a question about the Review Document or the routing guide in the comments of this issue.

ddeckard72 commented 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.

sunrick commented 9 years ago

@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.