aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource
diff options
context:
space:
mode:
Diffstat (limited to 'activeresource')
-rw-r--r--activeresource/CHANGELOG2
-rw-r--r--activeresource/README8
-rw-r--r--activeresource/lib/active_resource/base.rb46
3 files changed, 29 insertions, 27 deletions
diff --git a/activeresource/CHANGELOG b/activeresource/CHANGELOG
index 25557d9e77..46158cb208 100644
--- a/activeresource/CHANGELOG
+++ b/activeresource/CHANGELOG
@@ -1,3 +1,5 @@
+* Update XML documentation examples to include explicit type attributes. Closes #9754 [hasmanyjosh]
+
*2.0.0 [Preview Release]* (September 29th, 2007)
* Added one-off declarations of mock behavior [DHH]. Example:
diff --git a/activeresource/README b/activeresource/README
index 042af28e06..bcb7b3cbc7 100644
--- a/activeresource/README
+++ b/activeresource/README
@@ -60,7 +60,7 @@ for a request for a single element - the XML of that item is expected in respons
# Expects a response of
#
- # <person><id>1</id><attribute1>value1</attribute1><attribute2>..</attribute2></person>
+ # <person><id type="integer">1</id><attribute1>value1</attribute1><attribute2>..</attribute2></person>
#
# for GET http://api.people.com:3000/people/1.xml
#
@@ -88,9 +88,9 @@ Collections can also be requested in a similar fashion
# Expects a response of
#
- # <people>
- # <person><id>1</id><first>Ryan</first></person>
- # <person><id>2</id><first>Jim</first></person>
+ # <people type="array">
+ # <person><id type="integer">1</id><first>Ryan</first></person>
+ # <person><id type="integer">2</id><first>Jim</first></person>
# </people>
#
# for GET http://api.people.com:3000/people.xml
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb
index b1a79731b9..cc929aaee0 100644
--- a/activeresource/lib/active_resource/base.rb
+++ b/activeresource/lib/active_resource/base.rb
@@ -14,9 +14,9 @@ module ActiveResource
# Person maps to the resources people, very similarly to Active Record) and a +site+ value, which holds the
# URI of the resources.
#
- # class Person < ActiveResource::Base
- # self.site = "http://api.people.com:3000/"
- # end
+ # class Person < ActiveResource::Base
+ # self.site = "http://api.people.com:3000/"
+ # end
#
# Now the Person class is mapped to RESTful resources located at <tt>http://api.people.com:3000/people/</tt>, and
# you can now use Active Resource's lifecycles methods to manipulate resources.
@@ -26,19 +26,19 @@ module ActiveResource
# Active Resource exposes methods for creating, finding, updating, and deleting resources
# from REST web services.
#
- # ryan = Person.new(:first => 'Ryan', :last => 'Daigle')
- # ryan.save #=> true
- # ryan.id #=> 2
- # Person.exists?(ryan.id) #=> true
- # ryan.exists? #=> true
+ # ryan = Person.new(:first => 'Ryan', :last => 'Daigle')
+ # ryan.save #=> true
+ # ryan.id #=> 2
+ # Person.exists?(ryan.id) #=> true
+ # ryan.exists? #=> true
#
- # ryan = Person.find(1)
- # # => Resource holding our newly create Person object
+ # ryan = Person.find(1)
+ # # => Resource holding our newly create Person object
#
- # ryan.first = 'Rizzle'
- # ryan.save #=> true
+ # ryan.first = 'Rizzle'
+ # ryan.save #=> true
#
- # ryan.destroy #=> true
+ # ryan.destroy #=> true
#
# As you can see, these are very similar to Active Record's lifecycle methods for database records.
# You can read more about each of these methods in their respective documentation.
@@ -48,10 +48,10 @@ module ActiveResource
# Since simple CRUD/lifecycle methods can't accomplish every task, Active Resource also supports
# defining your own custom REST methods.
#
- # Person.new(:name => 'Ryan).post(:register)
+ # Person.new(:name => 'Ryan).post(:register)
# # => { :id => 1, :name => 'Ryan', :position => 'Clerk' }
#
- # Person.find(1).put(:promote, :position => 'Manager')
+ # Person.find(1).put(:promote, :position => 'Manager')
# # => { :id => 1, :name => 'Ryan', :position => 'Manager' }
#
# For more information on creating and using custom REST methods, see the
@@ -61,13 +61,13 @@ module ActiveResource
#
# You can validate resources client side by overriding validation methods in the base class.
#
- # class Person < ActiveResource::Base
- # self.site = "http://api.people.com:3000/"
- # protected
- # def validate
- # errors.add("last", "has invalid characters") unless last =~ /[a-zA-Z]*/
- # end
- # end
+ # class Person < ActiveResource::Base
+ # self.site = "http://api.people.com:3000/"
+ # protected
+ # def validate
+ # errors.add("last", "has invalid characters") unless last =~ /[a-zA-Z]*/
+ # end
+ # end
#
# See the ActiveResource::Validations documentation for more information.
#
@@ -137,7 +137,7 @@ module ActiveResource
# # is requested with invalid values, the response is:
# #
# # Response (422):
- # # <errors><error>First cannot be empty</error></errors>
+ # # <errors type="array"><error>First cannot be empty</error></errors>
# #
#
# ryan.errors.invalid?(:first) #=> true