Skip to content

Latest commit

 

History

History
26 lines (16 loc) · 981 Bytes

active_resource_basics.textile

File metadata and controls

26 lines (16 loc) · 981 Bytes

Active Resource Basics

This guide should provide you with all you need to get started managing the connection between business objects and RESTful web services. It implements a way to map web-based resources to local objects with CRUD semantics.

endprologue.

WARNING. This Guide is based on Rails 3.0. Some of the code shown here will not work in earlier versions of Rails.

Introduction

Active Resource allows you to connect with RESTful web services. So, in Rails, Resource classes inherited from ActiveResource::Base and live in app/models.

Configuration and Usage

Putting Active Resource to use is very similar to Active Record. It’s as simple as creating a model class
that inherits from ActiveResource::Base and providing a site class variable to it:

class Person < ActiveResource::Base
self.site = “http://api.people.com:3000/
end

Changelog