If you want to keep your client dumb, why not just let your server code validate uniqueness of your data, and skip any non-unique records, if you don't care much about them? It would allow the client to concentrate on the single task of feeding the data into the server, and let the server decide what to keep.
PS: you mentioned doing "parsing XML from the server" - if you're using Rails on the server, and it's restful - have you considered leveraging ActiveResource for your client? I personally find it to be the easiest and best match for Rails-bound interactions in many cases, as it basically removes the need for 90% of integration work and code. On Dec 14, 9:02 am, Craig Read <[email protected]> wrote: > Thanks for the responses Nicholas and Oleg. > > I have unique constraints in the database, but was wondering there might be a > "simple" (or "common") pattern for this. A fairly "dumb" script will be > performing the upload, and I'm hoping to avoid implementing much in the way > of exception handling. > > I'm currently working on parsing XML from the server. The list of items (that > I need to be unique) shouldn't be too large to just retrieve and compare > against before uploading to the server. > > I was considering creating actions to check the pre-existence of items, but > it doesn't feel right to create actions for something a user will never do > directly, and what will hopefully be run rarely. > > Cheers, > > -- > Craig Read > @Catharzhttps://github.com/Catharzhttp://code.google.com/p/bsss > -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
