<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 *Edge*
 
+* Add ActiveResource::Base.find(:last). [#754 state:resolved] (Adrian Mugnolo)
+
 * Fixed problems with the logger used if the logging string included %'s [#840 state:resolved] (Jamis Buck)
 
 * Fixed Base#exists? to check status code as integer [#299 state:resolved] (Wes Oldenbeuving)</diff>
      <filename>activeresource/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -13,43 +13,43 @@ module ActiveResource
   # to Ruby objects, Active Resource only needs a class name that corresponds to the resource name (e.g., the class
   # Person maps to the resources people, very similarly to Active Record) and a +site+ value, which holds the
   # URI of the resources.
-  # 
+  #
   #   class Person &lt; ActiveResource::Base
   #     self.site = &quot;http://api.people.com:3000/&quot;
   #   end
-  # 
+  #
   # Now the Person class is mapped to RESTful resources located at &lt;tt&gt;http://api.people.com:3000/people/&lt;/tt&gt;, and
-  # you can now use Active Resource's lifecycles methods to manipulate resources. In the case where you already have 
+  # you can now use Active Resource's lifecycles methods to manipulate resources. In the case where you already have
   # an existing model with the same name as the desired RESTful resource you can set the +element_name+ value.
   #
   #   class PersonResource &lt; ActiveResource::Base
   #     self.site = &quot;http://api.people.com:3000/&quot;
   #     self.element_name = &quot;person&quot;
   #   end
-  #  
-  # 
+  #
+  #
   # == Lifecycle methods
   #
   # Active Resource exposes methods for creating, finding, updating, and deleting resources
   # from REST web services.
-  # 
+  #
   #   ryan = Person.new(:first =&gt; 'Ryan', :last =&gt; 'Daigle')
   #   ryan.save                # =&gt; true
   #   ryan.id                  # =&gt; 2
   #   Person.exists?(ryan.id)  # =&gt; true
   #   ryan.exists?             # =&gt; true
-  # 
+  #
   #   ryan = Person.find(1)
   #   # Resource holding our newly created Person object
-  # 
+  #
   #   ryan.first = 'Rizzle'
   #   ryan.save                # =&gt; true
-  # 
+  #
   #   ryan.destroy             # =&gt; 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.
-  # 
+  #
   # === Custom REST methods
   #
   # Since simple CRUD/lifecycle methods can't accomplish every task, Active Resource also supports
@@ -71,14 +71,14 @@ module ActiveResource
   #
   #   # DELETE to 'fire' a person, i.e. DELETE /people/1/fire.xml.
   #   Person.find(1).delete(:fire)
-  # 
+  #
   # For more information on using custom REST methods, see the
   # ActiveResource::CustomMethods documentation.
   #
   # == Validations
   #
   # You can validate resources client side by overriding validation methods in the base class.
-  # 
+  #
   #   class Person &lt; ActiveResource::Base
   #      self.site = &quot;http://api.people.com:3000/&quot;
   #      protected
@@ -86,19 +86,19 @@ module ActiveResource
   #          errors.add(&quot;last&quot;, &quot;has invalid characters&quot;) unless last =~ /[a-zA-Z]*/
   #        end
   #   end
-  # 
+  #
   # See the ActiveResource::Validations documentation for more information.
   #
   # == Authentication
-  # 
+  #
   # Many REST APIs will require authentication, usually in the form of basic
   # HTTP authentication.  Authentication can be specified by:
   # * putting the credentials in the URL for the +site+ variable.
-  # 
+  #
   #    class Person &lt; ActiveResource::Base
   #      self.site = &quot;http://ryan:password@api.people.com:3000/&quot;
   #    end
-  # 
+  #
   # * defining +user+ and/or +password+ variables
   #
   #    class Person &lt; ActiveResource::Base
@@ -107,29 +107,29 @@ module ActiveResource
   #      self.password = &quot;password&quot;
   #    end
   #
-  # For obvious security reasons, it is probably best if such services are available 
+  # For obvious security reasons, it is probably best if such services are available
   # over HTTPS.
-  # 
-  # Note: Some values cannot be provided in the URL passed to site.  e.g. email addresses 
+  #
+  # Note: Some values cannot be provided in the URL passed to site.  e.g. email addresses
   # as usernames.  In those situations you should use the separate user and password option.
   # == Errors &amp; Validation
   #
   # Error handling and validation is handled in much the same manner as you're used to seeing in
   # Active Record.  Both the response code in the HTTP response and the body of the response are used to
   # indicate that an error occurred.
-  # 
+  #
   # === Resource errors
-  # 
+  #
   # When a GET is requested for a resource that does not exist, the HTTP &lt;tt&gt;404&lt;/tt&gt; (Resource Not Found)
   # response code will be returned from the server which will raise an ActiveResource::ResourceNotFound
   # exception.
-  # 
+  #
   #   # GET http://api.people.com:3000/people/999.xml
   #   ryan = Person.find(999) # 404, raises ActiveResource::ResourceNotFound
-  # 
+  #
   # &lt;tt&gt;404&lt;/tt&gt; is just one of the HTTP error response codes that Active Resource will handle with its own exception. The
   # following HTTP response codes will also result in these exceptions:
-  # 
+  #
   # * 200..399 - Valid response, no exception
   # * 404 - ActiveResource::ResourceNotFound
   # * 409 - ActiveResource::ResourceConflict
@@ -149,17 +149,17 @@ module ActiveResource
   #   end
   #
   # === Validation errors
-  # 
+  #
   # Active Resource supports validations on resources and will return errors if any these validations fail
-  # (e.g., &quot;First name can not be blank&quot; and so on).  These types of errors are denoted in the response by 
+  # (e.g., &quot;First name can not be blank&quot; and so on).  These types of errors are denoted in the response by
   # a response code of &lt;tt&gt;422&lt;/tt&gt; and an XML representation of the validation errors.  The save operation will
   # then fail (with a &lt;tt&gt;false&lt;/tt&gt; return value) and the validation errors can be accessed on the resource in question.
-  # 
+  #
   #   ryan = Person.find(1)
   #   ryan.first # =&gt; ''
   #   ryan.save  # =&gt; false
   #
-  #   # When 
+  #   # When
   #   # PUT http://api.people.com:3000/people/1.xml
   #   # is requested with invalid values, the response is:
   #   #
@@ -169,7 +169,7 @@ module ActiveResource
   #
   #   ryan.errors.invalid?(:first)  # =&gt; true
   #   ryan.errors.full_messages     # =&gt; ['First cannot be empty']
-  # 
+  #
   # Learn more about Active Resource's validation features in the ActiveResource::Validations documentation.
   #
   # === Timeouts
@@ -280,7 +280,7 @@ module ActiveResource
       #
       # Default format is &lt;tt&gt;:xml&lt;/tt&gt;.
       def format=(mime_type_reference_or_format)
-        format = mime_type_reference_or_format.is_a?(Symbol) ? 
+        format = mime_type_reference_or_format.is_a?(Symbol) ?
           ActiveResource::Formats[mime_type_reference_or_format] : mime_type_reference_or_format
 
         write_inheritable_attribute(&quot;format&quot;, format)
@@ -332,7 +332,7 @@ module ActiveResource
 
       attr_accessor_with_default(:collection_name) { element_name.pluralize } #:nodoc:
       attr_accessor_with_default(:primary_key, 'id') #:nodoc:
-      
+
       # Gets the prefix for a resource's nested URL (e.g., &lt;tt&gt;prefix/collectionname/1.xml&lt;/tt&gt;)
       # This method is regenerated at runtime based on what the prefix is set to.
       def prefix(options={})
@@ -381,21 +381,21 @@ module ActiveResource
       # +query_options+ - A hash to add items to the query string for the request.
       #
       # ==== Examples
-      #   Post.element_path(1) 
+      #   Post.element_path(1)
       #   # =&gt; /posts/1.xml
       #
-      #   Comment.element_path(1, :post_id =&gt; 5) 
+      #   Comment.element_path(1, :post_id =&gt; 5)
       #   # =&gt; /posts/5/comments/1.xml
       #
-      #   Comment.element_path(1, :post_id =&gt; 5, :active =&gt; 1) 
+      #   Comment.element_path(1, :post_id =&gt; 5, :active =&gt; 1)
       #   # =&gt; /posts/5/comments/1.xml?active=1
       #
-      #   Comment.element_path(1, {:post_id =&gt; 5}, {:active =&gt; 1}) 
+      #   Comment.element_path(1, {:post_id =&gt; 5}, {:active =&gt; 1})
       #   # =&gt; /posts/5/comments/1.xml?active=1
       #
       def element_path(id, prefix_options = {}, query_options = nil)
         prefix_options, query_options = split_options(prefix_options) if query_options.nil?
-        &quot;#{prefix(prefix_options)}#{collection_name}/#{id}.#{format.extension}#{query_string(query_options)}&quot;        
+        &quot;#{prefix(prefix_options)}#{collection_name}/#{id}.#{format.extension}#{query_string(query_options)}&quot;
       end
 
       # Gets the collection path for the REST resources.  If the +query_options+ parameter is omitted, Rails
@@ -410,13 +410,13 @@ module ActiveResource
       #   Post.collection_path
       #   # =&gt; /posts.xml
       #
-      #   Comment.collection_path(:post_id =&gt; 5) 
+      #   Comment.collection_path(:post_id =&gt; 5)
       #   # =&gt; /posts/5/comments.xml
       #
-      #   Comment.collection_path(:post_id =&gt; 5, :active =&gt; 1) 
+      #   Comment.collection_path(:post_id =&gt; 5, :active =&gt; 1)
       #   # =&gt; /posts/5/comments.xml?active=1
       #
-      #   Comment.collection_path({:post_id =&gt; 5}, {:active =&gt; 1}) 
+      #   Comment.collection_path({:post_id =&gt; 5}, {:active =&gt; 1})
       #   # =&gt; /posts/5/comments.xml?active=1
       #
       def collection_path(prefix_options = {}, query_options = nil)
@@ -451,50 +451,54 @@ module ActiveResource
       #   that_guy.valid? # =&gt; false
       #   that_guy.new?   # =&gt; true
       def create(attributes = {})
-        returning(self.new(attributes)) { |res| res.save }        
+        returning(self.new(attributes)) { |res| res.save }
       end
 
       # Core method for finding resources.  Used similarly to Active Record's +find+ method.
       #
       # ==== Arguments
-      # The first argument is considered to be the scope of the query.  That is, how many 
+      # The first argument is considered to be the scope of the query.  That is, how many
       # resources are returned from the request.  It can be one of the following.
       #
       # * &lt;tt&gt;:one&lt;/tt&gt; - Returns a single resource.
       # * &lt;tt&gt;:first&lt;/tt&gt; - Returns the first resource found.
+      # * &lt;tt&gt;:last&lt;/tt&gt; - Returns the last resource found.
       # * &lt;tt&gt;:all&lt;/tt&gt; - Returns every resource that matches the request.
-      # 
+      #
       # ==== Options
       #
       # * &lt;tt&gt;:from&lt;/tt&gt; - Sets the path or custom method that resources will be fetched from.
       # * &lt;tt&gt;:params&lt;/tt&gt; - Sets query and prefix (nested URL) parameters.
       #
       # ==== Examples
-      #   Person.find(1)                                         
+      #   Person.find(1)
       #   # =&gt; GET /people/1.xml
       #
-      #   Person.find(:all)                                      
+      #   Person.find(:all)
       #   # =&gt; GET /people.xml
       #
-      #   Person.find(:all, :params =&gt; { :title =&gt; &quot;CEO&quot; })      
+      #   Person.find(:all, :params =&gt; { :title =&gt; &quot;CEO&quot; })
       #   # =&gt; GET /people.xml?title=CEO
       #
-      #   Person.find(:first, :from =&gt; :managers)                  
+      #   Person.find(:first, :from =&gt; :managers)
+      #   # =&gt; GET /people/managers.xml
+      #
+      #   Person.find(:last, :from =&gt; :managers)
       #   # =&gt; GET /people/managers.xml
       #
-      #   Person.find(:all, :from =&gt; &quot;/companies/1/people.xml&quot;)  
+      #   Person.find(:all, :from =&gt; &quot;/companies/1/people.xml&quot;)
       #   # =&gt; GET /companies/1/people.xml
       #
-      #   Person.find(:one, :from =&gt; :leader)                    
+      #   Person.find(:one, :from =&gt; :leader)
       #   # =&gt; GET /people/leader.xml
       #
       #   Person.find(:all, :from =&gt; :developers, :params =&gt; { :language =&gt; 'ruby' })
       #   # =&gt; GET /people/developers.xml?language=ruby
       #
-      #   Person.find(:one, :from =&gt; &quot;/companies/1/manager.xml&quot;) 
+      #   Person.find(:one, :from =&gt; &quot;/companies/1/manager.xml&quot;)
       #   # =&gt; GET /companies/1/manager.xml
       #
-      #   StreetAddress.find(1, :params =&gt; { :person_id =&gt; 1 })  
+      #   StreetAddress.find(1, :params =&gt; { :person_id =&gt; 1 })
       #   # =&gt; GET /people/1/street_addresses/1.xml
       def find(*arguments)
         scope   = arguments.slice!(0)
@@ -503,6 +507,7 @@ module ActiveResource
         case scope
           when :all   then find_every(options)
           when :first then find_every(options).first
+          when :last  then find_every(options).last
           when :one   then find_one(options)
           else             find_single(scope, options)
         end
@@ -560,7 +565,7 @@ module ActiveResource
             instantiate_collection( (connection.get(path, headers) || []), prefix_options )
           end
         end
-        
+
         # Find a single resource from a one-off URL
         def find_one(options)
           case from = options[:from]
@@ -578,7 +583,7 @@ module ActiveResource
           path = element_path(scope, prefix_options, query_options)
           instantiate_record(connection.get(path, headers), prefix_options)
         end
-        
+
         def instantiate_collection(collection, prefix_options = {})
           collection.collect! { |record| instantiate_record(record, prefix_options) }
         end
@@ -602,10 +607,10 @@ module ActiveResource
 
         # Builds the query string for the request.
         def query_string(options)
-          &quot;?#{options.to_query}&quot; unless options.nil? || options.empty? 
+          &quot;?#{options.to_query}&quot; unless options.nil? || options.empty?
         end
 
-        # split an option hash into two hashes, one containing the prefix options, 
+        # split an option hash into two hashes, one containing the prefix options,
         # and the other containing the leftovers.
         def split_options(options = {})
           prefix_options, query_options = {}, {}
@@ -654,7 +659,7 @@ module ActiveResource
     #   ryan = Person.find(1)
     #   ryan.address = StreetAddress.find(1, :person_id =&gt; ryan.id)
     #   ryan.hash = {:not =&gt; &quot;an ARes instance&quot;}
-    #   
+    #
     #   not_ryan = ryan.clone
     #   not_ryan.new?            # =&gt; true
     #   not_ryan.address         # =&gt; NoMethodError
@@ -706,7 +711,7 @@ module ActiveResource
       id &amp;&amp; id.to_s
     end
 
-    # Test for equality.  Resource are equal if and only if +other+ is the same object or 
+    # Test for equality.  Resource are equal if and only if +other+ is the same object or
     # is an instance of the same class, is not &lt;tt&gt;new?&lt;/tt&gt;, and has the same +id+.
     #
     # ==== Examples
@@ -742,7 +747,7 @@ module ActiveResource
     def hash
       id.hash
     end
-    
+
     # Duplicate the current resource without saving it.
     #
     # ==== Examples
@@ -762,7 +767,7 @@ module ActiveResource
       end
     end
 
-    # A method to save (+POST+) or update (+PUT+) a resource.  It delegates to +create+ if a new object, 
+    # A method to save (+POST+) or update (+PUT+) a resource.  It delegates to +create+ if a new object,
     # +update+ if it is existing. If the response to the save includes a body, it will be assumed that this body
     # is XML for the final object as it looked after the save (which would include attributes like +created_at+
     # that weren't part of the original submit).
@@ -786,7 +791,7 @@ module ActiveResource
     #   my_person = Person.find(my_id)
     #   my_person.destroy
     #   Person.find(my_id) # 404 (Resource Not Found)
-    #   
+    #
     #   new_person = Person.create(:name =&gt; 'James')
     #   new_id = new_person.id # =&gt; 7
     #   new_person.destroy
@@ -825,7 +830,7 @@ module ActiveResource
     # * &lt;tt&gt;:indent&lt;/tt&gt; - Set the indent level for the XML output (default is +2+).
     # * &lt;tt&gt;:dasherize&lt;/tt&gt; - Boolean option to determine whether or not element names should
     #   replace underscores with dashes (default is &lt;tt&gt;false&lt;/tt&gt;).
-    # * &lt;tt&gt;:skip_instruct&lt;/tt&gt; - Toggle skipping the +instruct!+ call on the XML builder 
+    # * &lt;tt&gt;:skip_instruct&lt;/tt&gt; - Toggle skipping the +instruct!+ call on the XML builder
     #   that generates the XML declaration (default is &lt;tt&gt;false&lt;/tt&gt;).
     #
     # ==== Examples
@@ -849,7 +854,7 @@ module ActiveResource
     # ==== Examples
     #   my_branch = Branch.find(:first)
     #   my_branch.name # =&gt; &quot;Wislon Raod&quot;
-    #   
+    #
     #   # Another client fixes the typo...
     #
     #   my_branch.name # =&gt; &quot;Wislon Raod&quot;
@@ -897,7 +902,7 @@ module ActiveResource
       end
       self
     end
-    
+
     # For checking &lt;tt&gt;respond_to?&lt;/tt&gt; without searching the attributes (which is faster).
     alias_method :respond_to_without_attributes?, :respond_to?
 
@@ -909,7 +914,7 @@ module ActiveResource
       if attributes.nil?
         return super
       elsif attributes.has_key?(method_name)
-        return true 
+        return true
       elsif ['?','='].include?(method_name.last) &amp;&amp; attributes.has_key?(method_name.first(-1))
         return true
       end
@@ -917,7 +922,7 @@ module ActiveResource
       # would return true for generated readers, even if the attribute wasn't present
       super
     end
-    
+
 
     protected
       def connection(refresh = false)
@@ -938,7 +943,7 @@ module ActiveResource
           load_attributes_from_response(response)
         end
       end
-      
+
       def load_attributes_from_response(response)
         if response['Content-Length'] != &quot;0&quot; &amp;&amp; response.body.strip.size &gt; 0
           load(self.class.format.decode(response.body))
@@ -963,7 +968,7 @@ module ActiveResource
       def find_or_create_resource_for_collection(name)
         find_or_create_resource_for(name.to_s.singularize)
       end
-      
+
       # Tries to find a resource in a non empty list of nested modules
       # Raises a NameError if it was not found in any of the given nested modules
       def find_resource_in_modules(resource_name, module_names)</diff>
      <filename>activeresource/lib/active_resource/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,7 @@ class BaseTest &lt; Test::Unit::TestCase
   def setup
     @matz  = { :id =&gt; 1, :name =&gt; 'Matz' }.to_xml(:root =&gt; 'person')
     @david = { :id =&gt; 2, :name =&gt; 'David' }.to_xml(:root =&gt; 'person')
-    @greg  = { :id =&gt; 3, :name =&gt; 'Greg' }.to_xml(:root =&gt; 'person')    
+    @greg  = { :id =&gt; 3, :name =&gt; 'Greg' }.to_xml(:root =&gt; 'person')
     @addy  = { :id =&gt; 1, :street =&gt; '12345 Street' }.to_xml(:root =&gt; 'address')
     @default_request_headers = { 'Content-Type' =&gt; 'application/xml' }
     @rick = { :name =&gt; &quot;Rick&quot;, :age =&gt; 25 }.to_xml(:root =&gt; &quot;person&quot;)
@@ -50,7 +50,7 @@ class BaseTest &lt; Test::Unit::TestCase
     ActiveResource::HttpMock.respond_to do |mock|
       mock.get    &quot;/people/1.xml&quot;,                {}, @matz
       mock.get    &quot;/people/2.xml&quot;,                {}, @david
-      mock.get    &quot;/people/Greg.xml&quot;,             {}, @greg      
+      mock.get    &quot;/people/Greg.xml&quot;,             {}, @greg
       mock.get    &quot;/people/4.xml&quot;,                {'key' =&gt; 'value'}, nil, 404
       mock.put    &quot;/people/1.xml&quot;,                {}, nil, 204
       mock.delete &quot;/people/1.xml&quot;,                {}, nil, 200
@@ -62,7 +62,7 @@ class BaseTest &lt; Test::Unit::TestCase
       mock.get    &quot;/people/1/addresses/1.xml&quot;,    {}, @addy
       mock.get    &quot;/people/1/addresses/2.xml&quot;,    {}, nil, 404
       mock.get    &quot;/people/2/addresses/1.xml&quot;,    {}, nil, 404
-      mock.get    &quot;/people/Greg/addresses/1.xml&quot;, {}, @addy      
+      mock.get    &quot;/people/Greg/addresses/1.xml&quot;, {}, @addy
       mock.put    &quot;/people/1/addresses/1.xml&quot;,    {}, nil, 204
       mock.delete &quot;/people/1/addresses/1.xml&quot;,    {}, nil, 200
       mock.post   &quot;/people/1/addresses.xml&quot;,      {}, nil, 201, 'Location' =&gt; '/people/1/addresses/5'
@@ -101,13 +101,13 @@ class BaseTest &lt; Test::Unit::TestCase
     assert_equal 'http://foo:bar@beast.caboo.se', Forum.site.to_s
     assert_equal 'http://foo:bar@beast.caboo.se/forums/:forum_id', Topic.site.to_s
   end
-  
+
   def test_site_variable_can_be_reset
-    actor = Class.new(ActiveResource::Base)    
+    actor = Class.new(ActiveResource::Base)
     assert_nil actor.site
     actor.site = 'http://localhost:31337'
     actor.site = nil
-    assert_nil actor.site    
+    assert_nil actor.site
   end
 
   def test_should_accept_setting_user
@@ -194,18 +194,18 @@ class BaseTest &lt; Test::Unit::TestCase
     actor.site = 'http://nomad'
     assert_equal actor.site, jester.site
     assert jester.site.frozen?
-    
-    # Subclasses are always equal to superclass site when not overridden    
+
+    # Subclasses are always equal to superclass site when not overridden
     fruit = Class.new(ActiveResource::Base)
     apple = Class.new(fruit)
-    
+
     fruit.site = 'http://market'
     assert_equal fruit.site, apple.site, 'subclass did not adopt changes from parent class'
-    
+
     fruit.site = 'http://supermarket'
     assert_equal fruit.site, apple.site, 'subclass did not adopt changes from parent class'
   end
-  
+
   def test_user_reader_uses_superclass_user_until_written
     # Superclass is Object so returns nil.
     assert_nil ActiveResource::Base.user
@@ -317,14 +317,14 @@ class BaseTest &lt; Test::Unit::TestCase
   end
 
   def test_updating_baseclass_site_object_wipes_descendent_cached_connection_objects
-    # Subclasses are always equal to superclass site when not overridden    
+    # Subclasses are always equal to superclass site when not overridden
     fruit = Class.new(ActiveResource::Base)
     apple = Class.new(fruit)
-    
+
     fruit.site = 'http://market'
     assert_equal fruit.connection.site, apple.connection.site
     first_connection = apple.connection.object_id
-    
+
     fruit.site = 'http://supermarket'
     assert_equal fruit.connection.site, apple.connection.site
     second_connection = apple.connection.object_id
@@ -393,34 +393,34 @@ class BaseTest &lt; Test::Unit::TestCase
     assert_equal '/people.xml?gender=', Person.collection_path(:gender =&gt; nil)
 
     assert_equal '/people.xml?gender=male', Person.collection_path('gender' =&gt; 'male')
-    
+
     # Use includes? because ordering of param hash is not guaranteed
     assert Person.collection_path(:gender =&gt; 'male', :student =&gt; true).include?('/people.xml?')
     assert Person.collection_path(:gender =&gt; 'male', :student =&gt; true).include?('gender=male')
     assert Person.collection_path(:gender =&gt; 'male', :student =&gt; true).include?('student=true')
 
     assert_equal '/people.xml?name%5B%5D=bob&amp;name%5B%5D=your+uncle%2Bme&amp;name%5B%5D=&amp;name%5B%5D=false', Person.collection_path(:name =&gt; ['bob', 'your uncle+me', nil, false])
-    
+
     assert_equal '/people.xml?struct%5Ba%5D%5B%5D=2&amp;struct%5Ba%5D%5B%5D=1&amp;struct%5Bb%5D=fred', Person.collection_path(:struct =&gt; {:a =&gt; [2,1], 'b' =&gt; 'fred'})
   end
 
   def test_custom_element_path
     assert_equal '/people/1/addresses/1.xml', StreetAddress.element_path(1, :person_id =&gt; 1)
     assert_equal '/people/1/addresses/1.xml', StreetAddress.element_path(1, 'person_id' =&gt; 1)
-    assert_equal '/people/Greg/addresses/1.xml', StreetAddress.element_path(1, 'person_id' =&gt; 'Greg')    
+    assert_equal '/people/Greg/addresses/1.xml', StreetAddress.element_path(1, 'person_id' =&gt; 'Greg')
   end
-  
+
   def test_custom_element_path_with_redefined_to_param
     Person.module_eval do
       alias_method :original_to_param_element_path, :to_param
-       def to_param  
+       def to_param
          name
        end
     end
 
     # Class method.
     assert_equal '/people/Greg.xml', Person.element_path('Greg')
-    
+
     # Protected Instance method.
     assert_equal '/people/Greg.xml', Person.find('Greg').send(:element_path)
 
@@ -470,21 +470,21 @@ class BaseTest &lt; Test::Unit::TestCase
     assert_equal &quot;/&quot;, Person.prefix
     assert_equal Set.new, Person.send!(:prefix_parameters)
   end
-  
+
   def test_set_prefix
     SetterTrap.rollback_sets(Person) do |person_class|
       person_class.prefix = &quot;the_prefix&quot;
       assert_equal &quot;the_prefix&quot;, person_class.prefix
     end
   end
-  
+
   def test_set_prefix_with_inline_keys
     SetterTrap.rollback_sets(Person) do |person_class|
       person_class.prefix = &quot;the_prefix:the_param&quot;
       assert_equal &quot;the_prefixthe_param_value&quot;, person_class.prefix(:the_param =&gt; &quot;the_param_value&quot;)
     end
   end
-  
+
   def test_set_prefix_with_default_value
     SetterTrap.rollback_sets(Person) do |person_class|
       person_class.set_prefix
@@ -504,7 +504,7 @@ class BaseTest &lt; Test::Unit::TestCase
     assert_equal &quot;Matz&quot;, matz.name
     assert matz.name?
   end
-  
+
   def test_respond_to
     matz = Person.find(1)
     assert matz.respond_to?(:name)
@@ -533,6 +533,12 @@ class BaseTest &lt; Test::Unit::TestCase
     assert_equal &quot;Matz&quot;, matz.name
   end
 
+  def test_find_last
+    david = Person.find(:last)
+    assert_kind_of Person, david
+    assert_equal 'David', david.name
+  end
+
   def test_custom_header
     Person.headers['key'] = 'value'
     assert_raises(ActiveResource::ResourceNotFound) { Person.find(4) }
@@ -547,7 +553,7 @@ class BaseTest &lt; Test::Unit::TestCase
 
   def test_find_all_by_from
     ActiveResource::HttpMock.respond_to { |m| m.get &quot;/companies/1/people.xml&quot;, {}, @people_david }
-  
+
     people = Person.find(:all, :from =&gt; &quot;/companies/1/people.xml&quot;)
     assert_equal 1, people.size
     assert_equal &quot;David&quot;, people.first.name
@@ -555,7 +561,7 @@ class BaseTest &lt; Test::Unit::TestCase
 
   def test_find_all_by_from_with_options
     ActiveResource::HttpMock.respond_to { |m| m.get &quot;/companies/1/people.xml&quot;, {}, @people_david }
-  
+
     people = Person.find(:all, :from =&gt; &quot;/companies/1/people.xml&quot;)
     assert_equal 1, people.size
     assert_equal &quot;David&quot;, people.first.name
@@ -563,7 +569,7 @@ class BaseTest &lt; Test::Unit::TestCase
 
   def test_find_all_by_symbol_from
     ActiveResource::HttpMock.respond_to { |m| m.get &quot;/people/managers.xml&quot;, {}, @people_david }
-  
+
     people = Person.find(:all, :from =&gt; :managers)
     assert_equal 1, people.size
     assert_equal &quot;David&quot;, people.first.name
@@ -593,7 +599,7 @@ class BaseTest &lt; Test::Unit::TestCase
     p = Person.new
     resp = {'Location' =&gt; '/foo/bar/1'}
     assert_equal '1', p.send!(:id_from_response, resp)
-    
+
     resp['Location'] &lt;&lt; '.xml'
     assert_equal '1', p.send!(:id_from_response, resp)
   end
@@ -610,16 +616,16 @@ class BaseTest &lt; Test::Unit::TestCase
     ryan = Person.new(:id =&gt; 1, :name =&gt; 'Ryan', :address =&gt; address)
     assert_equal address.prefix_options, ryan.address.prefix_options
   end
-  
+
   def test_reload_works_with_prefix_options
     address = StreetAddress.find(1, :params =&gt; { :person_id =&gt; 1 })
     assert_equal address, address.reload
   end
-  
+
   def test_reload_with_redefined_to_param
     Person.module_eval do
       alias_method :original_to_param_reload, :to_param
-       def to_param  
+       def to_param
          name
        end
     end
@@ -634,13 +640,13 @@ class BaseTest &lt; Test::Unit::TestCase
         alias_method :reload_to_param, :to_param
         alias_method :to_param, :original_to_param_reload
       end
-  end  
-  
-  def test_reload_works_without_prefix_options    
+  end
+
+  def test_reload_works_without_prefix_options
     person = Person.find(:first)
     assert_equal person, person.reload
   end
-    
+
 
   def test_create
     rick = Person.create(:name =&gt; 'Rick')
@@ -650,11 +656,11 @@ class BaseTest &lt; Test::Unit::TestCase
 
     # test additional attribute returned on create
     assert_equal 25, rick.age
-    
+
     # Test that save exceptions get bubbled up too
     ActiveResource::HttpMock.respond_to do |mock|
       mock.post   &quot;/people.xml&quot;, {}, nil, 409
-    end    
+    end
     assert_raises(ActiveResource::ResourceConflict) { Person.create(:name =&gt; 'Rick') }
   end
 
@@ -716,7 +722,7 @@ class BaseTest &lt; Test::Unit::TestCase
     assert_equal &quot;54321 Lane&quot;, addy.street
     addy.save
   end
-  
+
   def test_update_conflict
     ActiveResource::HttpMock.respond_to do |mock|
       mock.get &quot;/people/2.xml&quot;, {}, @david
@@ -748,7 +754,7 @@ class BaseTest &lt; Test::Unit::TestCase
     end
     assert_raises(ActiveResource::ResourceNotFound) { Person.find(1) }
   end
-  
+
   def test_delete_with_custom_prefix
     assert StreetAddress.delete(1, :person_id =&gt; 1)
     ActiveResource::HttpMock.respond_to do |mock|
@@ -778,23 +784,23 @@ class BaseTest &lt; Test::Unit::TestCase
     assert !StreetAddress.new({:id =&gt; 1, :person_id =&gt; 2}).exists?
     assert !StreetAddress.new({:id =&gt; 2, :person_id =&gt; 1}).exists?
   end
-  
+
   def test_exists_with_redefined_to_param
     Person.module_eval do
       alias_method :original_to_param_exists, :to_param
-       def to_param  
+       def to_param
          name
        end
     end
 
     # Class method.
-    assert Person.exists?('Greg')    
+    assert Person.exists?('Greg')
 
     # Instance method.
-    assert Person.find('Greg').exists?    
+    assert Person.find('Greg').exists?
 
     # Nested class method.
-    assert StreetAddress.exists?(1,  :params =&gt; { :person_id =&gt; Person.find('Greg').to_param })    
+    assert StreetAddress.exists?(1,  :params =&gt; { :person_id =&gt; Person.find('Greg').to_param })
 
     # Nested instance method.
     assert StreetAddress.find(1, :params =&gt; { :person_id =&gt; Person.find('Greg').to_param }).exists?
@@ -806,8 +812,8 @@ class BaseTest &lt; Test::Unit::TestCase
         alias_method :exists_to_param, :to_param
         alias_method :to_param, :original_to_param_exists
       end
-  end  
-  
+  end
+
   def test_to_xml
     matz = Person.find(1)
     xml = matz.to_xml</diff>
      <filename>activeresource/test/base_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1129a24caff9f1804c2bff6569c0cbd8598dfa86</id>
    </parent>
  </parents>
  <author>
    <name>Adrian Mugnolo</name>
    <email>adrian@mugnolo.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/893fb5bb639b0938f6762ef1165b05abae255986</url>
  <id>893fb5bb639b0938f6762ef1165b05abae255986</id>
  <committed-date>2008-08-21T19:06:57-07:00</committed-date>
  <authored-date>2008-08-21T19:03:26-07:00</authored-date>
  <message>Add ActiveResource::Base.find(:last). [#754 state:resolved]

Signed-off-by: Pratik Naik &lt;pratiknaik@gmail.com&gt;</message>
  <tree>650d95e7a7bd89f4298d316ca5bfeb34c13ec748</tree>
  <committer>
    <name>Pratik Naik</name>
    <email>pratiknaik@gmail.com</email>
  </committer>
</commit>
