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