Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8503

Show
Ignore:
Timestamp:
12/28/07 17:12:35 (8 months ago)
Author:
rick
Message:

Allow setting ActiveResource::Base#format before #site. [rick]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activeresource/CHANGELOG

    r8502 r8503  
    11*SVN* 
     2 
     3* Allow setting ActiveResource::Base#format before #site.  [rick] 
    24 
    35* Support agnostic formats when calling custom methods.  Closes #10635 [joerichsen] 
  • trunk/activeresource/lib/active_resource/base.rb

    r8472 r8503  
    193193 
    194194        write_inheritable_attribute("format", format) 
    195         connection.format = format 
     195        connection.format = format if site 
    196196      end 
    197197       
  • trunk/activeresource/test/format_test.rb

    r8502 r8503  
    6565  end 
    6666   
     67  def test_setting_format_before_site 
     68    resource = Class.new(ActiveResource::Base) 
     69    resource.format = :json 
     70    resource.site   = 'http://37s.sunrise.i:3000' 
     71    assert_equal ActiveResource::Formats[:json], resource.connection.format 
     72  end 
     73   
    6774  private 
    6875    def using_format(klass, mime_type_reference)