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

Changeset 1223

Show
Ignore:
Timestamp:
04/19/05 10:26:03 (3 years ago)
Author:
david
Message:

Fixed stringification on all assigned hashes. The sacrifice is that assigns[:person] wont work in testing. Instead assignsperson? or assigns(:person) must be used. In other words, the keys of assigns stay strings but weve added a method-based accessor to appease the need for symbols.

Files:

Legend:

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

    r1221 r1223  
    11*SVN* 
     2 
     3* Fixed stringification on all assigned hashes. The sacrifice is that assigns[:person] won't work in testing. Instead assigns["person"] or assigns(:person) must be used. In other words, the keys of assigns stay strings but we've added a method-based accessor to appease the need for symbols. 
    24 
    35* Fixed that rendering a template would require a connection to the database #1146 
  • trunk/actionpack/lib/action_controller/assertions.rb

    r1216 r1223  
    1515    # These collections can be used just like any other hash: 
    1616    # 
    17     #   assert_not_nil assigns[:person] # makes sure that a @person instance variable was set 
     17    #   assert_not_nil assigns(:person) # makes sure that a @person instance variable was set 
    1818    #   assert_equal "Dave", cookies[:name] # makes sure that a cookie called :name was set as "Dave" 
    1919    #   assert flash.empty? # makes sure that there's nothing in the flash 
     20    # 
     21    # For historic reasons, the assigns hash uses string-based keys. So assigns[:person] won't work, but assigns["person"] will. To 
     22    # appease our yearning for symbols, though, an alternative accessor has been deviced using a method call instead of index referencing. 
     23    # So assigns(:person) will work just like assigns["person"], but again, assigns[:person] will not work. 
    2024    # 
    2125    # On top of the collections, you have the complete url that a given action redirected to available in redirect_to_url. 
  • trunk/actionpack/lib/action_view/base.rb

    r1189 r1223  
    158158 
    159159    def initialize(base_path = nil, assigns_for_first_render = {}, controller = nil)#:nodoc: 
    160       @base_path, @assigns = base_path, assigns_for_first_render.with_indifferent_access 
     160      @base_path, @assigns = base_path, assigns_for_first_render 
    161161      @controller = controller 
    162162    end