Can ActiveResource use ActiveRecord::Dirty?

So, I’ve been working with Rails for quite a while, but pretty new to
actually digging in and patching/plugging the actual source methods of
Rails modules.

I’m trying to use ActiveRecord to create some Ruby wrappers for a
couple API’s, but having to patch/rewrite so many of the
ActiveResource methods to fit each particular API (not necessarily
ActiveResource-compatible API’s mind you). It’s getting to the point
that I’m wondering if it’s even worth it to try using ActiveResource.

Anyway, I was wondering if there is any quick/easy way of using
ActiveRecord’s Dirty module with ActiveResource, so that I can use
methods such as “Person.changed?”, etc. with ActiveResource objects.
Has anyone tried this, or does anyone see any huge hurdles to
attempting this?

I’ve tried just doing this:

require ‘rubygems’
require ‘activeresource’
require ‘active_record/dirty’

And then I have:

class Base < ActiveResource::Base

class MyObject < Base

end
end

Now how do I actually try attaching the “Dirty” methods to my objects,
which are inheriting from ActiveResource::Base?

1 Like