You just include it in your model. Here's a post I did on using it,
but you'll find jnunemaker's info more well written:
http://scottmotte.com/archives/218.html
On Jun 30, 11:52 pm, Henry Maddocks <henry.maddo...@gmail.com> wrote:
> I am thinking of writing an 'Active Record like' interface to a public
> API (Digital NZ in this case). What's the best way to go about it?
> Should I write an adapter?
> Should I monkey patch the find methods on Active Record?
> Should I avoid Active Record entirely?
> Or is there an easier way?
I'm not certain, but I'm pretty sure that means you'd have to go
through the process of creating helpers, packaging them up as a gem -
basically building your own object relational mapper. Not sure what
you're building, but my 2 cents would say that's a lot of work :). My
understanding is that basically activerecord is just a big thing of
syntactic sugar that maps to the low level sql. I'm no expert though.
I've never built an orm or even helped with one so maybe someone else
can chime in.
On Jun 30, 5:30 pm, Henry Maddocks <henry.maddo...@gmail.com> wrote:
> I recommend using httparty. Works like a charm for apis.
> That's a bit lower level than I was thinking. I've already got the http > stuff working. > What I'm after is the recommended way to provide the active record style > interface, eg > find_by_blah :order => 'foo', :limit => 'lots and lots'
I mention it for a place to get example code rather than something that will
do what you want.
It's from the previously mentioned and much admired John Nunkemaker,
too. I would imagine it would have some fresher ideas than
ActiveResource as is it a brandnew piece of code.
All this might be for not. Judging by your post to DigitalNZ list, you've
already done the work.
Cheers,
Walter
On Wed, Jul 1, 2009 at 2:42 PM, Henry Maddocks <henry.maddo...@gmail.com>wrote: