Rails architecture questions

Posted by justinbach on Stack Overflow See other posts from Stack Overflow or by justinbach
Published on 2010-05-01T12:04:37Z Indexed on 2010/05/01 12:07 UTC
Read the original article Hit count: 209

I'm building a Rails site that, among other things, allows users to build their own recipe repository. Recipes are entered either manually or via a link to another site (think epicurious, cooks.com, etc). I'm writing scripts that will scrape a recipe from these sites given a link from a user, and so far (legal issues notwithstanding) that part isn't giving me any trouble.

However, I'm not sure where to put the code that I'm writing for these scraper scripts. My first thought was to put it in the recipes model, but it seems a bit too involved to go there; would a library or a helper be more appropriate?

Also, as I mentioned, I'm building several different scrapers for different food websites. It seems to me that the elegant way to do this would be to define an interface (or abstract base class) that determines a set of methods for constructing a recipe object given a link, but I'm not sure what the best approach would be here, either. How might I build out these OO relationships, and where should the code go?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about architecture