0
@@ -14,9 +14,9 @@ module ActiveResource
0
# Person maps to the resources people, very similarly to Active Record) and a +site+ value, which holds the
0
# URI of the resources.
0
- # class Person < ActiveResource::Base
0
- # self.site = "http://api.people.com:3000/"
0
+ # class Person < ActiveResource::Base
0
+ # self.site = "http://api.people.com:3000/"
0
# Now the Person class is mapped to RESTful resources located at <tt>http://api.people.com:3000/people/</tt>, and
0
# you can now use Active Resource's lifecycles methods to manipulate resources.
0
@@ -26,19 +26,19 @@ module ActiveResource
0
# Active Resource exposes methods for creating, finding, updating, and deleting resources
0
# from REST web services.
0
- # ryan = Person.new(:first => 'Ryan', :last => 'Daigle')
0
- # Person.exists?(ryan.id) #=> true
0
- # ryan.exists? #=> true
0
+ # ryan = Person.new(:first => 'Ryan', :last => 'Daigle')
0
+ # Person.exists?(ryan.id) #=> true
0
+ # ryan.exists? #=> true
0
- # ryan = Person.find(1)
0
- # # => Resource holding our newly create Person object
0
+ # ryan = Person.find(1)
0
+ # # => Resource holding our newly create Person object
0
- # ryan.first = 'Rizzle'
0
+ # ryan.first = 'Rizzle'
0
- #
ryan.destroy #=> true
0
+ #
ryan.destroy #=> true
0
# As you can see, these are very similar to Active Record's lifecycle methods for database records.
0
# You can read more about each of these methods in their respective documentation.
0
@@ -48,10 +48,10 @@ module ActiveResource
0
# Since simple CRUD/lifecycle methods can't accomplish every task, Active Resource also supports
0
# defining your own custom REST methods.
0
- # Person.new(:name => 'Ryan).post(:register)
0
+ # Person.new(:name => 'Ryan).post(:register)
0
# # => { :id => 1, :name => 'Ryan', :position => 'Clerk' }
0
- # Person.find(1).put(:promote, :position => 'Manager')
0
+ # Person.find(1).put(:promote, :position => 'Manager')
0
# # => { :id => 1, :name => 'Ryan', :position => 'Manager' }
0
# For more information on creating and using custom REST methods, see the
0
@@ -61,13 +61,13 @@ module ActiveResource
0
# You can validate resources client side by overriding validation methods in the base class.
0
- # class Person < ActiveResource::Base
0
- # self.site = "http://api.people.com:3000/"
0
- # errors.add("last", "has invalid characters") unless last =~ /[a-zA-Z]*/
0
+ # class Person < ActiveResource::Base
0
+ # self.site = "http://api.people.com:3000/"
0
+ # errors.add("last", "has invalid characters") unless last =~ /[a-zA-Z]*/
0
# See the ActiveResource::Validations documentation for more information.
0
@@ -137,7 +137,7 @@ module ActiveResource
0
# # is requested with invalid values, the response is:
0
- # # <errors
><error>First cannot be empty</error></errors>
0
+ # # <errors
type="array"><error>First cannot be empty</error></errors>
0
# ryan.errors.invalid?(:first) #=> true
Comments
No one has commented yet.