Permalink
Browse files

Update XML documentation examples to include explicit type attributes.

…Closes #9754 [hasmanyjosh]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8090 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
Marcel Molina
Marcel Molina committed Nov 6, 2007
1 parent 026973f commit 7863c4a18a4991c4942f52a4f88bbc1bdd9b7572
Showing with 29 additions and 27 deletions.
  1. +2 −0 activeresource/CHANGELOG
  2. +4 −4 activeresource/README
  3. +23 −23 activeresource/lib/active_resource/base.rb
View
@@ -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:
View
@@ -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
@@ -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

0 comments on commit 7863c4a

Please sign in to comment.