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

Changeset 8811

Show
Ignore:
Timestamp:
02/07/08 16:46:50 (7 months ago)
Author:
rick
Message:

Fix bug with setting Request#format= after the getter has cached the value. Closes #10889 [cch1]

Files:

Legend:

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

    r8807 r8811  
    11*SVN* 
     2 
     3* Fix bug with setting Request#format= after the getter has cached the value.  #10889 [cch1] 
    24 
    35* Correct inconsistencies in RequestForgeryProtection docs.  #11032 [mislav] 
  • trunk/actionpack/lib/action_controller/request.rb

    r8625 r8811  
    114114    def format=(extension) 
    115115      parameters[:format] = extension.to_s 
    116       format 
     116      @format = Mime::Type.lookup_by_extension(parameters[:format]) 
    117117    end 
    118118 
  • trunk/actionpack/test/controller/request_test.rb

    r8564 r8811  
    370370    @request.env["CONTENT_TYPE"] = "text/html" 
    371371    assert_equal Mime::HTML, @request.content_type 
     372  end 
     373 
     374  def test_format_assignment_should_set_format 
     375    @request.instance_eval { self.format = :txt } 
     376    assert !@request.format.xml? 
     377    @request.instance_eval { self.format = :xml } 
     378    assert @request.format.xml? 
    372379  end 
    373380