Commit Graph

244 Commits

Author SHA1 Message Date
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
Carlos Antonio da Silva
a18b73b43c Remove all deprecation warnings in activeresource
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 13:38:38 +02:00
José Valim
599e46bf24 Revert "Setup explicit requires for files with exceptions. Removed them from autoloading."
Booting a new Rails application does not work after this commit [#5359 state:open]

This reverts commit 38a421b34d0b414564e919f67d339fac067a56e6.
2010-09-02 21:11:03 +02:00
Łukasz Strzałkowski
38a421b34d Setup explicit requires for files with exceptions. Removed them from autoloading.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:54:04 +02:00
Mikel Lindsaar
58d0e2c23c Adding option to ActiveResource to allow you to not reset the previously stored requests and responses by passing false to respond_to 2010-08-29 22:54:19 -07:00
Mikel Lindsaar
a299642293 Updating documentation on ActiveResource HTTP Mock and also adding test coverage 2010-08-29 22:54:19 -07:00
Jaime Iniesta
5430f5bd06 lifecycle should be two words, life cycle 2010-08-26 14:23:58 +02:00
Mikel Lindsaar
c1b49f1e18 Make ActiveResource::InvalidRequestError more user friendly
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-08-25 10:00:37 +02:00
Joost Baaij
20333be581 fix broken relative links [#5415 state:committed]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-08-24 16:20:32 +02:00
David Heinemeier Hansson
21b1f29720 Master is now targeting 3.1.0.beta 2010-08-23 21:44:57 -05:00
Santiago Pastorino
b451de0d6d Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
Xavier Noria
4f7565c4de adds missing requires for Object#try 2010-08-09 15:25:21 +02:00
Josef Reidinger
59693c4c49 fix loading of different elements in array then int and string [#5036 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-02 17:06:09 +02:00
David Heinemeier Hansson
856fc4bbc3 Prep for RC 2010-07-26 12:53:25 -05:00
Josef Reidinger
0e969bdaf8 fix escaping id and parameters in path [#5137 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-26 16:59:47 +02:00
Santiago Pastorino
b0b9bf3204 Object#returning removed
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-25 23:30:27 +02:00
David Trasbo
df083b482d Make sure ActiveResource::Errors#from_json doesn't pass nil to #from_array [#3650 state:commited]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-26 19:23:10 +02:00
Elomar França
176c386409 Fix bug where ActiveResource::HttpMock would overwrite Accept/Content-Type header to application/xml [#4939 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-24 13:25:10 +02:00
José Valim
6788db824a Move Rails::LogSubscriber to ActiveSupport::LogSubscriber, allowing frameworks like ActiveRecord and ActiveResource to log outsude Rails::Application [#4816 state:resolved] 2010-06-24 13:23:43 +02:00
Evgeniy Dolzhenko
ef404c771d Fix a bunch of minor spelling mistakes 2010-06-15 12:04:22 +04:00
Ryan Bigg
f453bb6d8a There is no type="array" returned with errors. [#3691:resolved] 2010-06-12 12:13:21 +10:00
Evgeniy Dolzhenko
ccf9577aee Fix a bunch of minor spelling mistakes 2010-06-11 14:15:34 +04:00
David Heinemeier Hansson
32d4330b81 Get ready for beta 4 2010-06-08 14:47:02 -04:00
Elomar França
15b0947579 Adding to_key to ActiveResource objects using ActiveModel::Conversion [#4685 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-03 23:32:09 +10:00
Santiago Pastorino
aacf2581cd refactor evals and adds some __FILE__ and __LINE__
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-20 15:18:57 +02:00
Santiago Pastorino
7ffe76046a ActiveResource shouldn't consider modules in the path
[#4529 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 09:38:32 +02:00
Neeraj Singh
a0621c1086 Better code formatting and proper line numbers for stack traces
[#4596 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-14 12:24:01 -07:00
Santiago Pastorino
903637f5f0 Fixes to_json and to_xml for ActiveResource
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-12 21:02:31 +02:00
Santiago Pastorino
bea3c26833 Make ActiveResource serialize XML correctly when element_name is set.
[#4529]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-12 09:31:36 -07:00
Justin George
731d4392e4 Change event namespace ordering to most-significant first [#4504 state:resolved]
More work still needs to be done on some of these names
(render_template.action_view and render_template!.action_view particularly)
but this allows (for example) /^sql/ to subscribe to all
the various ORMs without further modification

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-02 22:45:54 +02:00
Santiago Pastorino
7cd1d37a51 Reuse Active Model serialization in Active Resource. [#2584 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-26 15:00:26 -07:00
Jeremy Kemper
2a6e0f34ad Revert "create option to include_root_in_json for ActiveResource [#2584 state:committed]"
This reverts commits 72f89b5d971b48a133c4c0af56fbeda35d738dae, 137d8e0b2fe9fcc4fdac6cbbd44ca010784e5972.

Should reuse Active Model.

[#2584 state:incomplete]
2010-04-25 21:04:19 -07:00
José Valim
ee309d506c Update versions (otherwise you install a gem from source as beta3 but internally it's beta2) and update CHANGELOG. 2010-04-10 12:17:34 +02:00
Santiago Pastorino
13e00ce606 fix stack trace lines on class_eval
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-09 21:28:49 +02:00
Santiago Pastorino
72f89b5d97 create option to include_root_in_json for ActiveResource [#2584 state:committed] 2010-04-05 17:47:02 -03:00
David Heinemeier Hansson
d868cb4f8a Prep for beta2, depend on latest Bundler 2010-04-01 13:36:45 -07:00
Xavier Noria
76f024ac8d adds missing requires for Object#blank? and Object#present? 2010-03-28 14:15:02 +02:00
Xavier Noria
105f9b8154 adds missing requires for Object#duplicable? 2010-03-28 13:26:13 +02:00
Gaël Deest
753304bd11 Makes ActiveResource work with form_for: - Adds a build' method that can be used instead of new' to load a new, unsaved resource from the remote site, filled with the correct default values. - Adds a persisted?' method that simply returns the opposite value than the new?' method. [#4222 state:resolved] [#4155 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
2010-03-27 01:40:46 -07:00