Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 62 lines (44 sloc) 2.247 kb
8261f17 Jeremy Kemper start an Active Resource changelog
jeremy authored
1 *SVN*
2
7ac6ed8 risk danger olson Add Basic HTTP Authentication to ActiveResource (closes #6305). [jonatha...
technoweenie authored
3 * Add Basic HTTP Authentication to ActiveResource (closes #6305). [jonathan]
4
4d63e01 risk danger olson fixed failing tests now that non-GET requests are sent with .xml file ex...
technoweenie authored
5 * Extracted #id_from_response as an entry point for customizing how a created resource gets its own ID.
6 By default, it extracts from the Location response header.
7
0a84624 Jeremy Kemper Optimistic locking: raise ActiveResource::ResourceConflict on 409 Confli...
jeremy authored
8 * Optimistic locking: raise ActiveResource::ResourceConflict on 409 Conflict response. [Jeremy Kemper]
9
10 # Example controller action
11 def update
12 @person.save!
13 rescue ActiveRecord::StaleObjectError
14 render :xml => @person.reload.to_xml, :status => '409 Conflict'
15 end
16
8d9e660 risk danger olson Basic validation support [Rick Olson]
technoweenie authored
17 * Basic validation support [Rick Olson]
18
19 Parses the xml response of ActiveRecord::Errors#to_xml with a similar interface to ActiveRecord::Errors.
20
21 render :xml => @person.errors.to_xml, :status => '400 Validation Error'
22
c918fbf Jeremy Kemper Deep hashes are converted into collections of resources. Class attribute...
jeremy authored
23 * Deep hashes are converted into collections of resources. [Jeremy Kemper]
24 Person.new :name => 'Bob',
25 :address => { :id => 1, :city => 'Portland' },
26 :contacts => [{ :id => 1 }, { :id => 2 }]
27 Looks for Address and Contact resources and creates them if unavailable.
28 So clients can fetch a complex resource in a single request if you e.g.
29 render :xml => @person.to_xml(:include => [:address, :contacts])
30 in your controller action.
31
7749c9c risk danger olson Major updates to ActiveResource, please see changelog and unit tests [Ri...
technoweenie authored
32 * Major updates [Rick Olson]
33
34 * Add full support for find/create/update/destroy
35 * Add support for specifying prefixes.
36 * Allow overriding of element_name, collection_name, and primary key
37 * Provide simpler HTTP mock interface for testing
38
39 # rails routing code
40 map.resources :posts do |post|
41 post.resources :comments
42 end
43
44 # ActiveResources
45 class Post < ActiveResource::Base
46 self.site = "http://37s.sunrise.i:3000/"
47 end
48
49 class Comment < ActiveResource::Base
50 self.site = "http://37s.sunrise.i:3000/posts/:post_id/"
51 end
52
53 @post = Post.find 5
54 @comments = Comment.find :all, :post_id => @post.id
55
56 @comment = Comment.new({:body => 'hello world'}, {:post_id => @post.id})
57 @comment.save
58
f9b3694 Jeremy Kemper 200...400 are valid response codes. PUT and POST request bodies default ...
jeremy authored
59 * Base.site= accepts URIs. 200...400 are valid response codes. PUT and POST request bodies default to ''. [Jeremy Kemper]
c1af2db Jeremy Kemper site= accepts URIs
jeremy authored
60
8261f17 Jeremy Kemper start an Active Resource changelog
jeremy authored
61 * Initial checkin: object-oriented client for restful HTTP resources which follow the Rails convention. [DHH]
Something went wrong with that request. Please try again.