aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/lib/active_resource
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-08-14 02:13:00 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2010-08-14 04:12:33 -0300
commitb451de0d6de4df6bc66b274cec73b919f823d5ae (patch)
treef252c4143a0adb3be7d36d543282539cca0fb971 /activeresource/lib/active_resource
parent1590377886820e00b1a786616518a32f3b61ec0f (diff)
downloadrails-b451de0d6de4df6bc66b274cec73b919f823d5ae.tar.gz
rails-b451de0d6de4df6bc66b274cec73b919f823d5ae.tar.bz2
rails-b451de0d6de4df6bc66b274cec73b919f823d5ae.zip
Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;)
Diffstat (limited to 'activeresource/lib/active_resource')
-rw-r--r--activeresource/lib/active_resource/http_mock.rb8
-rw-r--r--activeresource/lib/active_resource/validations.rb16
2 files changed, 12 insertions, 12 deletions
diff --git a/activeresource/lib/active_resource/http_mock.rb b/activeresource/lib/active_resource/http_mock.rb
index 75425c01c0..a98af88a37 100644
--- a/activeresource/lib/active_resource/http_mock.rb
+++ b/activeresource/lib/active_resource/http_mock.rb
@@ -41,7 +41,7 @@ module ActiveResource
# mock.delete "/people/1.xml", {}, nil, 200
# end
# end
- #
+ #
# def test_get_matz
# person = Person.find(1)
# assert_equal "Matz", person.name
@@ -77,13 +77,13 @@ module ActiveResource
# mock.get "/people/1.xml", {}, @matz
# end
# end
- #
+ #
# def test_should_request_remote_service
# person = Person.find(1) # Call the remote service
- #
+ #
# # This request object has the same HTTP method and path as declared by the mock
# expected_request = ActiveResource::Request.new(:get, "/people/1.xml")
- #
+ #
# # Assert that the mock received, and responded to, the expected request from the model
# assert ActiveResource::HttpMock.requests.include?(expected_request)
# end
diff --git a/activeresource/lib/active_resource/validations.rb b/activeresource/lib/active_resource/validations.rb
index 026d81e44a..adceac2f61 100644
--- a/activeresource/lib/active_resource/validations.rb
+++ b/activeresource/lib/active_resource/validations.rb
@@ -6,7 +6,7 @@ module ActiveResource
end
# Active Resource validation is reported to and from this object, which is used by Base#save
- # to determine whether the object in a valid state to be saved. See usage example in Validations.
+ # to determine whether the object in a valid state to be saved. See usage example in Validations.
class Errors < ActiveModel::Errors
# Grabs errors from an array of messages (like ActiveRecord::Validations)
# The second parameter directs the errors cache to be cleared (default)
@@ -20,7 +20,7 @@ module ActiveResource
add humanized_attributes[attr_name], message[(attr_name.size + 1)..-1]
end
end
-
+
self[:base] << message if attr_message.nil?
end
end
@@ -37,15 +37,15 @@ module ActiveResource
from_array array, save_cache
end
end
-
+
# Module to support validation and errors with Active Resource objects. The module overrides
- # Base#save to rescue ActiveResource::ResourceInvalid exceptions and parse the errors returned
- # in the web service response. The module also adds an +errors+ collection that mimics the interface
+ # Base#save to rescue ActiveResource::ResourceInvalid exceptions and parse the errors returned
+ # in the web service response. The module also adds an +errors+ collection that mimics the interface
# of the errors provided by ActiveRecord::Errors.
#
# ==== Example
#
- # Consider a Person resource on the server requiring both a +first_name+ and a +last_name+ with a
+ # Consider a Person resource on the server requiring both a +first_name+ and a +last_name+ with a
# <tt>validates_presence_of :first_name, :last_name</tt> declaration in the model:
#
# person = Person.new(:first_name => "Jim", :last_name => "")
@@ -55,7 +55,7 @@ module ActiveResource
# person.errors.count # => 1
# person.errors.full_messages # => ["Last name can't be empty"]
# person.errors[:last_name] # => ["can't be empty"]
- # person.last_name = "Halpert"
+ # person.last_name = "Halpert"
# person.save # => true (and person is now saved to the remote service)
#
module Validations
@@ -118,7 +118,7 @@ module ActiveResource
# also any errors returned from the remote system the last time we
# saved.
# Remote errors can only be cleared by trying to re-save the resource.
- #
+ #
# ==== Examples
# my_person = Person.create(params[:person])
# my_person.valid?