Commit Graph

341 Commits

Author SHA1 Message Date
Jim Herzberg
a78a75d67a activeresource should treat HTTP status 307 as redirection, same as 301 and 302; added missing test cases for statii 301 and 302. 2011-10-11 17:46:24 -07:00
José Valim
d4457dc32b Provide read_attribute_for_serialization as the API to serialize attributes. 2011-09-30 14:20:41 +02:00
Colin Shield & Ian Lesperance
41365a8275 Fixed digest authentication for requests with a query string [#3158] 2011-09-28 15:23:47 -07:00
Jon Leighton
8397a564cb Merge pull request #2678 from jmileham/ares_content_length_bug
ActiveResource shouldn't rely on the presence of Content-Length
2011-09-12 10:11:39 -07:00
John Mileham
a06d17480f ActiveResource shouldn't rely on the presence of Content-Length 2011-09-11 14:46:50 -04:00
Marc G Gauthier
28d605ff7f Do not use objects that don't respond to to_sym (integers, floats, dates...) as parameters 2011-09-01 18:26:29 +02:00
Marc G Gauthier
03b9630617 Do not try to use as a parameter elements that are not acceptable 2011-08-19 11:11:17 +02:00
Oemuer Oezkir
71d18ce48e Changed a few instances of of words in the API docs written in British English to
American English(according to Weber)
2011-07-24 10:21:42 +00:00
Santiago Pastorino
35cdd256c0 Master version is 3.2.0.beta 2011-06-30 10:18:36 -03:00
Xavier Noria
5e21247131 Merge branch 'master' of git://github.com/lifo/docrails
Conflicts:
	activerecord/RUNNING_UNIT_TESTS
2011-06-06 22:23:30 +02:00
Vijay Dev
e1b202fc70 annotate class_eval method for active resource schema attributes 2011-06-05 21:44:04 +05:30
Lee Reilly
4f234bfd79 Corrected some typos and American vs. Queen's English issues 2011-05-29 12:40:24 -07:00
Guillermo Iguaran
647c55ac43 Prefer each instead of for in activeresource 2011-05-23 23:08:48 -05:00
David Heinemeier Hansson
82857adc56 Bump versions for rc1 2011-05-21 20:56:52 -05:00
Josh Kalderimis
1bfe9ec5de attr_accessor_with_default is deprecated, so lets not use it in ActiveResource 2011-05-21 01:05:35 -04:00
Josh Kalderimis
00958696d8 corrected some further tests and docs for the ARes change to json change 2011-05-18 00:34:10 -04:00
Josh Kalderimis
6b4bbb4274 updated all the tests in ARes to work with json 2011-05-18 00:34:09 -04:00
Vijay Dev
3f36441e90 Update copyright year in Active Resource and Active Support
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-05-09 20:17:23 -03:00
David Heinemeier Hansson
169ae75e09 Prepare for beta1 2011-05-04 20:21:05 -05:00
Xavier Noria
cea3b3cc9d Merge branch 'master' of git://github.com/lifo/docrails 2011-05-04 14:51:04 +02:00
Chris Griego
a962bfe472 Optimize ActiveResource::Base.new(attributes)
* Add performance benchmark similar to ActiveRecord
* Lazily find_or_create_resource_for_collection to not incur the overhead for empty arrays and arrays of primatives
* #duplicable? is faster than inline rescues when the object is not duplicable
* Don't constantly raise and handle NameError, raising is expensive
* Even when a resource is nested inside a module, always look inside the class first for the resource definition so we don't overwrite classes all the time

Before:                                     user     system      total        real
Model.new (instantiation)               0.120000   0.000000   0.120000 (  0.119961)
Nested::Model.new (instantiation)       0.150000   0.010000   0.160000 (  0.151183)
Model.new (setting attributes)         28.540000   0.680000  29.220000 ( 29.271775)
Nested::Model.new (setting attributes) 29.740000   0.580000  30.320000 ( 30.486210)

After:                                        user     system      total        real
Model.new (instantiation)                 0.120000   0.000000   0.120000 (  0.121249)
Nested::Model.new (instantiation)         0.150000   0.010000   0.160000 (  0.152429)
Model.new (setting attributes)           11.480000   0.170000  11.650000 ( 11.656163)
Nested::Model.new (setting attributes)   11.510000   0.210000  11.720000 ( 11.724249)
2011-05-01 23:13:08 -05:00
Sebastian Martinez
06b9138188 Added some docs on ActiveResource::HttpMock 2011-05-01 15:59:27 -03:00
Sebastian Martinez
825dae1f0b Documented ActiveResource#observing 2011-05-01 15:50:53 -03:00
Sebastian Martinez
2472428881 Remove extra whitespaces. 2011-05-01 15:46:01 -03:00
Sebastian Martinez
31110c50e4 Fix punctuation errors. 2011-05-01 15:33:27 -03:00
Prem Sichanugrist
733bfa63f5 Remove #among? from Active Support
After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now.

It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
2011-04-13 20:25:28 +08:00
David Heinemeier Hansson
d1575ae1b9 Change Object#either? to Object#among? -- thanks to @jamesarosen for the suggestion! 2011-04-12 00:23:07 +02:00
Prem Sichanugrist
a9f3c9da01 Using Object#in? and Object#either? in various places
There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
2011-04-11 03:17:09 +08:00
R.T. Lechow
48841dd6ae Active Resource typos. 2011-03-05 11:56:34 +01:00
Josh Bassett
056be15212 Fixed a bug where ActiveResource::HttpMock would not replace an existing response when passing a block to the respond_to method.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-09 19:25:53 -02:00
Akira Matsuda
78ecb2485e make the example code a bit more accurate 2011-01-29 09:02:54 +09:00
Akira Matsuda
8f24471989 Fix indentation 2011-01-29 08:15:31 +09:00
Josh Kalderimis
d7db6a8873 class inheritable attributes is used no more! all internal use of class inheritable has been changed to class_attribute. class inheritable attributes has been deprecated.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-20 19:40:29 +01:00
Carl Lerche
ccd2f3ede5 Update the version.rb files to include a PRE part 2010-11-16 17:19:46 -08:00
wycats
cc8e386d08 Always pull in version for frameworks (standardize autoload / require / none) 2010-10-10 16:12:04 -07:00
Gaston Ramos
cec6f3fe20 - update documentation
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-07 16:50:47 +02:00
Gaston Ramos
b9f8501f82 - Fix ActiveResource::HttpMock.respond_to replace the response
if it has the same request

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-07 16:50:34 +02:00
Santiago Pastorino
42fad8c82b PERF: more changes from inject({}) to Hash + map 2010-10-03 15:03:59 -02:00
Emilio Tagua
71acc2737a Move uri parser to AS as URI.parser method to reuse it in AP and ARes. 2010-09-28 11:38:35 +08:00
Matthijs Langenberg
67a838574b Fix broken module namespacing in ActiveResource with Ruby 1.9 [#5699 state:resolved]
Following namespace use case was broken with Ruby 1.9:

  class Author < ActiveRecord::Base
    ...
  end

  module Api
    class Book < ActiveResouce::Base
    end
  end

Let's say XML contains <book><author><name>John</name></author>....

  Api::Book.first.author.class.to_s #=>
    Ruby 1.8.7: "Api::Book::Author" (namespaced, correct),
    Ruby 1.9: "Author" (toplevel, broken)

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-27 23:10:55 +02:00
Gaston Ramos
e405dbcb48 - update exceptions documentation 2010-09-27 15:25:39 -03:00
Gaston Ramos
823a8e6e66 - check prefix options in collection_path 2010-09-27 15:25:33 -03:00
Gaston Ramos
30fb3638cc - refactoring, move prefix_options check to a custom method 2010-09-27 15:25:23 -03:00
Gaston Ramos
a71e07d61e - elmenth_path raise an ActiveResource::MissingPrefixParam exception when prefix_options does not has all required prefix_options ex: class StreetAddress < ActiveResource::Base self.site = "http://37s.sunrise.i:3000/people/:person_id/" end
StreetAddress.element_path(1)
    # => ActiveResource::MissingPrefixParam
2010-09-27 15:25:16 -03:00
Jacques Crocker
51f1f550da Allow per Resource format settings
Previously, ActiveResource was using the connection level formatter for get requests. This made it impossible to use custom formatters per resource.

Additionally this commit makes the Connection request methods more consistent. It always returns a Response. The base will then decode it each the response using its format setting.

Merging this commit will allow users to add custom formatters on a per Resource basis. This enables handling pagination responses from the server side, a very common use case that was previously impossible without monkeypatching XmlFormat.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 13:54:09 +02:00
Jacques Crocker
ee5ef67c44 Allow ActiveResource to work with non-generated ids [#5660 state:resolved]
This commit updates new? so that it knows whether or not the record was actually new or not, and doesn't rely solely on the presence of id. This enables the ability to set a custom primary_key that is not autogenerated by the server.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 11:15:40 +02:00
Emilio Tagua
0876f39088 No need to use inject here.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:03 -03:00
Thiago Pradi
3c9bf6e1dc Exception handling more readable
[#5601 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-19 12:18:51 -07:00
Mike Abner
154081f0f7 make sure a Content-Length header exists and that the response.body is not nil before trying to call methods on it. Rack does not allow HTTP 204 responses to have a content-length header set. [#5038 state:resolved] 2010-09-18 20:49:45 +02:00
Emilio Tagua
a521a3c05a Remove TODO and support all expected attributes.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-17 17:03:51 +02:00