ActiveResource


#1

Can someone give me a quick rundown on ActiveResource? Is is included
in rails 1.2.3? How do I start using it? How does it work with
ActiveRecord? Is there a script/generate command for it? Where is the
documentation and tutorials?

Thanks in advance.


#2

Can someone give me a quick rundown on ActiveResource? Is is included
in rails 1.2.3? How do I start using it? How does it work with
ActiveRecord? Is there a script/generate command for it? Where is the
documentation and tutorials?

Active Resource has yet to get an official release. It’s not included
in 1.2.3, only available from SVN.

Ryan has an intro at:
http://ryandaigle.com/articles/2006/06/30/whats-new-in-edge-rails-activeresource-is-here
Guide to get it working in your app:
http://reprocessed.org/blog/archives/2006/08/01/active_resource_on_edge.html


#3

Is there a version being targeted for adding it to rails?

b


#4

I submitted a patch to do just this but was told that ARes will probably
be
an external install from Rails. For now, as says the guide DHH posted,
you’ll need to manually type out the path to the activeresource install.
Otherwise, the library works quite well and I’ve yet to find any issues
with
it.

Simply define your models to be:

class MyResource < ActiveResource::Base
self.site_url = “http://path/to/server
… credentials …
end

and you’re on your way. You only get #find for now, depending on how
much
data the server is sending back (the :include directive of to_xml).

Just a warning though, I did have a problem with the server code and
#to_xml, described here: http://dev.rubyonrails.org/ticket/8017

Jason