Changeset 6584
- Timestamp:
- 04/26/07 01:53:01 (2 years ago)
- Files:
-
- trunk/activeresource/CHANGELOG (modified) (1 diff)
- trunk/activeresource/lib/active_resource.rb (modified) (1 diff)
- trunk/activeresource/lib/active_resource/base.rb (modified) (1 diff)
- trunk/activeresource/lib/active_resource/custom_methods.rb (added)
- trunk/activeresource/lib/active_resource/http_mock.rb (modified) (1 diff)
- trunk/activeresource/test/base_test.rb (modified) (1 diff)
- trunk/activeresource/test/base/custom_methods_test.rb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activeresource/CHANGELOG
r6569 r6584 1 1 *SVN* 2 3 * Added support for calling custom methods #6979 [rwdaigle] 4 5 Person.find(:managers) # => GET /people/managers.xml 6 Kase.find(1).post(:close) # => POST /kases/1/close.xml 2 7 3 8 * Remove explicit prefix_options parameter for ActiveResource::Base#initialize. [Rick] trunk/activeresource/lib/active_resource.rb
r6119 r6584 38 38 require 'active_resource/struct' 39 39 require 'active_resource/validations' 40 require 'active_resource/custom_methods' 40 41 41 42 module ActiveResource 42 43 Base.class_eval do 43 44 include Validations 45 include CustomMethods 44 46 end 45 47 end trunk/activeresource/lib/active_resource/base.rb
r6570 r6584 123 123 when :all then find_every(options) 124 124 when :first then find_every(options).first 125 when Symbol then get(scope, options) 125 126 else find_single(scope, options) 126 127 end trunk/activeresource/lib/active_resource/http_mock.rb
r6539 r6584 111 111 headers[key] = value 112 112 end 113 114 def ==(other) 115 if (other.is_a?(Response)) 116 other.body == body && other.message == message && other.headers == headers 117 else 118 false 119 end 120 end 113 121 end 114 122 trunk/activeresource/test/base_test.rb
r6568 r6584 96 96 97 97 assert_equal '/people.xml?gender=male', Person.collection_path('gender' => 'male') 98 assert_equal '/people.xml?gender=male&student=true', Person.collection_path(:gender => 'male', :student => true) 98 99 # Use includes? because ordering of param hash is not guaranteed 100 assert Person.collection_path(:gender => 'male', :student => true).include?('/people.xml?') 101 assert Person.collection_path(:gender => 'male', :student => true).include?('gender=male') 102 assert Person.collection_path(:gender => 'male', :student => true).include?('student=true') 99 103 100 104 assert_equal '/people.xml?name%5B%5D=bob&name%5B%5D=your+uncle%2Bme&name%5B%5D=&name%5B%5D=false', Person.collection_path(:name => ['bob', 'your uncle+me', nil, false])