I have a Rails app that I intend to seed with data generated by a log parsing program (written in a later version of Ruby). I want some basic checking to make sure I'm not duplicating reference data, etc.
Should I be creating custom find / exists actions in the relevant controllers just for this, or is there a better way of doing this?
Cheers,
--
Craig Read
@Catharz
https://github.com/Catharz
http://code.google.com/p/bsss
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
@Catharz
https://github.com/Catharz
http://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 rails-...@googlegroups.com.
> To unsubscribe from this group, send email to rails-oceani...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
>
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.
I hadn't considered using ActiveResource (still very much a newbie at Rails). I had a look at it over lunch though, and that's exactly how I'll do it.
Thanks for the help!
Cheers,
--
Craig Read
@Catharz
https://github.com/Catharz
http://code.google.com/p/bsss