657293489359487feaf3849f9a20d665c3d1edc3
[feedcatcher.git] / vendor / rails / activeresource / CHANGELOG
1 *2.3.2 [Final] (March 15, 2009)*
2
3 * Nothing new, just included in 2.3.2
4
5
6 *2.2.1 [RC2] (November 14th, 2008)*
7
8 * Fixed that ActiveResource#post would post an empty string when it shouldn't be posting anything #525 [Paolo Angelini]
9
10
11 *2.2.0 [RC1] (October 24th, 2008)*
12
13 * Add ActiveResource::Base#to_xml and ActiveResource::Base#to_json. #1011 [Rasik Pandey, Cody Fauser]
14
15 * Add ActiveResource::Base.find(:last). [#754 state:resolved] (Adrian Mugnolo)
16
17 * Fixed problems with the logger used if the logging string included %'s [#840 state:resolved] (Jamis Buck)
18
19 * Fixed Base#exists? to check status code as integer [#299 state:resolved] (Wes Oldenbeuving)
20
21
22 *2.1.0 (May 31st, 2008)*
23
24 * Fixed response logging to use length instead of the entire thing (seangeo) [#27]
25
26 * Fixed that to_param should be used and honored instead of hardcoding the id #11406 [gspiers]
27
28 * Improve documentation. [Ryan Bigg, Jan De Poorter, Cheah Chu Yeow, Xavier Shay, Jack Danger Canty, Emilio Tagua, Xavier Noria, Sunny Ripert]
29
30 * Use HEAD instead of GET in exists? [bscofield]
31
32 * Fix small documentation typo. Closes #10670 [Luca Guidi]
33
34 * find_or_create_resource_for handles module nesting. #10646 [xavier]
35
36 * Allow setting ActiveResource::Base#format before #site. [Rick Olson]
37
38 * Support agnostic formats when calling custom methods. Closes #10635 [joerichsen]
39
40 * Document custom methods. #10589 [Cheah Chu Yeow]
41
42 * Ruby 1.9 compatibility. [Jeremy Kemper]
43
44
45 *2.0.2* (December 16th, 2007)
46
47 * Added more specific exceptions for 400, 401, and 403 (all descending from ClientError so existing rescues will work) #10326 [trek]
48
49 * Correct empty response handling. #10445 [seangeo]
50
51
52 *2.0.1* (December 7th, 2007)
53
54 * Don't cache net/http object so that ActiveResource is more thread-safe. Closes #10142 [kou]
55
56 * Update XML documentation examples to include explicit type attributes. Closes #9754 [Josh Susser]
57
58 * Added one-off declarations of mock behavior [David Heinemeier Hansson]. Example:
59
60 Before:
61 ActiveResource::HttpMock.respond_to do |mock|
62 mock.get "/people/1.xml", {}, "<person><name>David</name></person>"
63 end
64
65 Now:
66 ActiveResource::HttpMock.respond_to.get "/people/1.xml", {}, "<person><name>David</name></person>"
67
68 * Added ActiveResource.format= which defaults to :xml but can also be set to :json [David Heinemeier Hansson]. Example:
69
70 class Person < ActiveResource::Base
71 self.site = "http://app/"
72 self.format = :json
73 end
74
75 person = Person.find(1) # => GET http://app/people/1.json
76 person.name = "David"
77 person.save # => PUT http://app/people/1.json {name: "David"}
78
79 Person.format = :xml
80 person.name = "Mary"
81 person.save # => PUT http://app/people/1.json <person><name>Mary</name></person>
82
83 * Fix reload error when path prefix is used. #8727 [Ian Warshak]
84
85 * Remove ActiveResource::Struct because it hasn't proven very useful. Creating a new ActiveResource::Base subclass is often less code and always clearer. #8612 [Josh Peek]
86
87 * Fix query methods on resources. [Cody Fauser]
88
89 * pass the prefix_options to the instantiated record when using find without a specific id. Closes #8544 [Eloy Duran]
90
91 * Recognize and raise an exception on 405 Method Not Allowed responses. #7692 [Josh Peek]
92
93 * Handle string and symbol param keys when splitting params into prefix params and query params.
94
95 Comment.find(:all, :params => { :article_id => 5, :page => 2 }) or Comment.find(:all, :params => { 'article_id' => 5, :page => 2 })
96
97 * Added find-one with symbol [David Heinemeier Hansson]. Example: Person.find(:one, :from => :leader) # => GET /people/leader.xml
98
99 * BACKWARDS INCOMPATIBLE: Changed the finder API to be more extensible with :params and more strict usage of scopes [David Heinemeier Hansson]. Changes:
100
101 Person.find(:all, :title => "CEO") ...becomes: Person.find(:all, :params => { :title => "CEO" })
102 Person.find(:managers) ...becomes: Person.find(:all, :from => :managers)
103 Person.find("/companies/1/manager.xml") ...becomes: Person.find(:one, :from => "/companies/1/manager.xml")
104
105 * Add support for setting custom headers per Active Resource model [Rick Olson]
106
107 class Project
108 headers['X-Token'] = 'foo'
109 end
110
111 # makes the GET request with the custom X-Token header
112 Project.find(:all)
113
114 * Added find-by-path options to ActiveResource::Base.find [David Heinemeier Hansson]. Examples:
115
116 employees = Person.find(:all, :from => "/companies/1/people.xml") # => GET /companies/1/people.xml
117 manager = Person.find("/companies/1/manager.xml") # => GET /companies/1/manager.xml
118
119
120 * Added support for using classes from within a single nested module [David Heinemeier Hansson]. Example:
121
122 module Highrise
123 class Note < ActiveResource::Base
124 self.site = "http://37s.sunrise.i:3000"
125 end
126
127 class Comment < ActiveResource::Base
128 self.site = "http://37s.sunrise.i:3000"
129 end
130 end
131
132 assert_kind_of Highrise::Comment, Note.find(1).comments.first
133
134
135 * Added load_attributes_from_response as a way of loading attributes from other responses than just create [David Heinemeier Hansson]
136
137 class Highrise::Task < ActiveResource::Base
138 def complete
139 load_attributes_from_response(post(:complete))
140 end
141 end
142
143 ...will set "done_at" when complete is called.
144
145
146 * Added support for calling custom methods #6979 [rwdaigle]
147
148 Person.find(:managers) # => GET /people/managers.xml
149 Kase.find(1).post(:close) # => POST /kases/1/close.xml
150
151 * Remove explicit prefix_options parameter for ActiveResource::Base#initialize. [Rick Olson]
152 ActiveResource splits the prefix_options from it automatically.
153
154 * Allow ActiveResource::Base.delete with custom prefix. [Rick Olson]
155
156 * Add ActiveResource::Base#dup [Rick Olson]
157
158 * Fixed constant warning when fetching the same object multiple times [David Heinemeier Hansson]
159
160 * Added that saves which get a body response (and not just a 201) will use that response to update themselves [David Heinemeier Hansson]
161
162 * Disregard namespaces from the default element name, so Highrise::Person will just try to fetch from "/people", not "/highrise/people" [David Heinemeier Hansson]
163
164 * Allow array and hash query parameters. #7756 [Greg Spurrier]
165
166 * Loading a resource preserves its prefix_options. #7353 [Ryan Daigle]
167
168 * Carry over the convenience of #create from ActiveRecord. Closes #7340. [Ryan Daigle]
169
170 * Increase ActiveResource::Base test coverage. Closes #7173, #7174 [Rich Collins]
171
172 * Interpret 422 Unprocessable Entity as ResourceInvalid. #7097 [dkubb]
173
174 * Mega documentation patches. #7025, #7069 [rwdaigle]
175
176 * Base.exists?(id, options) and Base#exists? check whether the resource is found. #6970 [rwdaigle]
177
178 * Query string support. [untext, Jeremy Kemper]
179 # GET /forums/1/topics.xml?sort=created_at
180 Topic.find(:all, :forum_id => 1, :sort => 'created_at')
181
182 * Base#==, eql?, and hash methods. == returns true if its argument is identical to self or if it's an instance of the same class, is not new?, and has the same id. eql? is an alias for ==. hash delegates to id. [Jeremy Kemper]
183
184 * Allow subclassed resources to share the site info [Rick Olson, Jeremy Kemper]
185 d
186 class BeastResource < ActiveResource::Base
187 self.site = 'http://beast.caboo.se'
188 end
189
190 class Forum < BeastResource
191 # taken from BeastResource
192 # self.site = 'http://beast.caboo.se'
193 end
194
195 class Topic < BeastResource
196 self.site += '/forums/:forum_id'
197 end
198
199 * Fix issues with ActiveResource collection handling. Closes #6291. [bmilekic]
200
201 * Use attr_accessor_with_default to dry up attribute initialization. References #6538. [Stuart Halloway]
202
203 * Add basic logging support for logging outgoing requests. [Jamis Buck]
204
205 * Add Base.delete for deleting resources without having to instantiate them first. [Jamis Buck]
206
207 * Make #save behavior mimic AR::Base#save (true on success, false on failure). [Jamis Buck]
208
209 * Add Basic HTTP Authentication to ActiveResource (closes #6305). [jonathan]
210
211 * Extracted #id_from_response as an entry point for customizing how a created resource gets its own ID.
212 By default, it extracts from the Location response header.
213
214 * Optimistic locking: raise ActiveResource::ResourceConflict on 409 Conflict response. [Jeremy Kemper]
215
216 # Example controller action
217 def update
218 @person.save!
219 rescue ActiveRecord::StaleObjectError
220 render :xml => @person.reload.to_xml, :status => '409 Conflict'
221 end
222
223 * Basic validation support [Rick Olson]
224
225 Parses the xml response of ActiveRecord::Errors#to_xml with a similar interface to ActiveRecord::Errors.
226
227 render :xml => @person.errors.to_xml, :status => '400 Validation Error'
228
229 * Deep hashes are converted into collections of resources. [Jeremy Kemper]
230 Person.new :name => 'Bob',
231 :address => { :id => 1, :city => 'Portland' },
232 :contacts => [{ :id => 1 }, { :id => 2 }]
233 Looks for Address and Contact resources and creates them if unavailable.
234 So clients can fetch a complex resource in a single request if you e.g.
235 render :xml => @person.to_xml(:include => [:address, :contacts])
236 in your controller action.
237
238 * Major updates [Rick Olson]
239
240 * Add full support for find/create/update/destroy
241 * Add support for specifying prefixes.
242 * Allow overriding of element_name, collection_name, and primary key
243 * Provide simpler HTTP mock interface for testing
244
245 # rails routing code
246 map.resources :posts do |post|
247 post.resources :comments
248 end
249
250 # ActiveResources
251 class Post < ActiveResource::Base
252 self.site = "http://37s.sunrise.i:3000/"
253 end
254
255 class Comment < ActiveResource::Base
256 self.site = "http://37s.sunrise.i:3000/posts/:post_id/"
257 end
258
259 @post = Post.find 5
260 @comments = Comment.find :all, :post_id => @post.id
261
262 @comment = Comment.new({:body => 'hello world'}, {:post_id => @post.id})
263 @comment.save
264
265 * Base.site= accepts URIs. 200...400 are valid response codes. PUT and POST request bodies default to ''. [Jeremy Kemper]
266
267 * Initial checkin: object-oriented client for restful HTTP resources which follow the Rails convention. [David Heinemeier Hansson]