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