Ruby on Rails
Wednesday, October 14, 2015
I do have access to it "live" in a sense. It gets replicated down to a server I have access to at different times of the day. I don't currently have a way of knowing which records have changed so I'm going to have to do some comparisons to see what, if anything, has changed for each record. I could create the boolean column on that table though and if it fails validation I'll just flag the record. This sounds like a good plan!
On Wednesday, October 14, 2015 at 2:40:01 AM UTC-4, Colin Law wrote:
-- On Wednesday, October 14, 2015 at 2:40:01 AM UTC-4, Colin Law wrote:
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
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8ba0bd18-bd56-4f33-b48e-76b6c8ff8071%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment