I'm currently trying to setup daily processes that will import information 
into my database.  I have many records that fail validations, and for the 
most part I have methods that attempt to auto-correct them and re-save, but 
there are some more complex scenarios that require a user to correct some 
information before they're valid.  I'm trying to come up with a good way in 
which I can set this up and I've come up with two methods, but I'm not sure 
which I should really go with...

*Scenario 1:*

I figure I could import into my models like I normally do, and when they 
don't pass validations then I will go ahead and save them to the database 
anyways and then flag them with a boolean column as "invalid".  Then I'll 
setup an action and view to allow the user to see and correct all the 
records that have been flagged.  

*Pros:* The pro to this method is I don't have to create various new 
models/tables for each model that I'm importing into for temporary storage.
*Cons:* I'm still storing bad data in the table, and also would have to 
alter many queries to filter out invalid records based on the boolean 
column I would add to the model.

*Scenario 2:*

I create new models that mimic the model that I want to import the records 
into... but then I'm adding alot of logic that is shared between the two -- 
not to mention I have a lot of additional files and code.  However, this 
method wouldn't have me storing invalid data in my tables.


Thoughts?

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/41a66ff1-2a65-45cc-b6bb-09f7aa57bfa4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to