On 13 October 2015 at 22:47, David McDonald <
dave...@gmail.com> wrote:
> I get my data from a database that I have access to that is updated at
> different points during the day. As far as having a custom validation
> method, I have that. Here's a, hopefully, more descriptive example of what
> is going on.
>
> I have my Rails app, and I import records into that database on a daily
> basis from a database I have no control over. During importing of those
> records some pass my validations and some do not. I have some methods in
> place that will attempt to correct the column's data that is failing my
> validation, but sometimes they can't be corrected unless they have a user
> manually look into it and correct that data. I'm attempting to come up with
> a solution that allows me to get a list of those records that failed
> validation to allow a user to use my app to change the problem information
> and then attempt to save the record to the database.
Can you access the other database 'live'? If so then presumably you
have some method of knowing which records in the external database
have been successfully imported. Again if so then extend that method
to include an indication of records that you attempted to import but
which failed. Then in your app you can use that to fetch the data
from the failed external records again and allow the user to correct
it.
If you cannot access the external db live then my preferred option
would be to go for an intermediate table. The import operation would
import into that table and a second phase would move records from that
into the final table. Any records which could not be moved would be
left in the intermediate table for later correction.
Colin