Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 48 lines (34 sloc) 1.711 kb
8261f17 @jeremy start an Active Resource changelog
jeremy authored
1 *SVN*
2
8d9e660 @technoweenie Basic validation support [Rick Olson]
technoweenie authored
3 * Basic validation support [Rick Olson]
4
5 Parses the xml response of ActiveRecord::Errors#to_xml with a similar interface to ActiveRecord::Errors.
6
7 render :xml => @person.errors.to_xml, :status => '400 Validation Error'
8
c918fbf @jeremy Deep hashes are converted into collections of resources. Class attribute...
jeremy authored
9 * Deep hashes are converted into collections of resources. [Jeremy Kemper]
10 Person.new :name => 'Bob',
11 :address => { :id => 1, :city => 'Portland' },
12 :contacts => [{ :id => 1 }, { :id => 2 }]
13 Looks for Address and Contact resources and creates them if unavailable.
14 So clients can fetch a complex resource in a single request if you e.g.
15 render :xml => @person.to_xml(:include => [:address, :contacts])
16 in your controller action.
17
7749c9c @technoweenie Major updates to ActiveResource, please see changelog and unit tests [Ri...
technoweenie authored
18 * Major updates [Rick Olson]
19
20 * Add full support for find/create/update/destroy
21 * Add support for specifying prefixes.
22 * Allow overriding of element_name, collection_name, and primary key
23 * Provide simpler HTTP mock interface for testing
24
25 # rails routing code
26 map.resources :posts do |post|
27 post.resources :comments
28 end
29
30 # ActiveResources
31 class Post < ActiveResource::Base
32 self.site = "http://37s.sunrise.i:3000/"
33 end
34
35 class Comment < ActiveResource::Base
36 self.site = "http://37s.sunrise.i:3000/posts/:post_id/"
37 end
38
39 @post = Post.find 5
40 @comments = Comment.find :all, :post_id => @post.id
41
42 @comment = Comment.new({:body => 'hello world'}, {:post_id => @post.id})
43 @comment.save
44
f9b3694 @jeremy 200...400 are valid response codes. PUT and POST request bodies default ...
jeremy authored
45 * Base.site= accepts URIs. 200...400 are valid response codes. PUT and POST request bodies default to ''. [Jeremy Kemper]
c1af2db @jeremy site= accepts URIs
jeremy authored
46
8261f17 @jeremy start an Active Resource changelog
jeremy authored
47 * Initial checkin: object-oriented client for restful HTTP resources which follow the Rails convention. [DHH]
Something went wrong with that request. Please try again.