Permalink
Browse files

Fixed stringification on all assigned hashes. The sacrifice is that a…

…ssigns[:person] wont work in testing. Instead assigns["person"] 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.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1223 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent aa236c4 commit 865874ab6a8be80d896604ba4106e14b57ebfdc5 @dhh dhh committed Apr 19, 2005
Showing with 8 additions and 2 deletions.
  1. +2 −0 actionpack/CHANGELOG
  2. +5 −1 actionpack/lib/action_controller/assertions.rb
  3. +1 −1 actionpack/lib/action_view/base.rb
@@ -1,5 +1,7 @@
*SVN*
+* 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.
+
* Fixed that rendering a template would require a connection to the database #1146
@@ -14,10 +14,14 @@ module Unit #:nodoc:
#
# These collections can be used just like any other hash:
#
- # assert_not_nil assigns[:person] # makes sure that a @person instance variable was set
+ # assert_not_nil assigns(:person) # makes sure that a @person instance variable was set
# assert_equal "Dave", cookies[:name] # makes sure that a cookie called :name was set as "Dave"
# assert flash.empty? # makes sure that there's nothing in the flash
#
+ # For historic reasons, the assigns hash uses string-based keys. So assigns[:person] won't work, but assigns["person"] will. To
+ # appease our yearning for symbols, though, an alternative accessor has been deviced using a method call instead of index referencing.
+ # So assigns(:person) will work just like assigns["person"], but again, assigns[:person] will not work.
+ #
# On top of the collections, you have the complete url that a given action redirected to available in redirect_to_url.
#
# For redirects within the same controller, you can even call follow_redirect and the redirect will be follow triggering another
@@ -157,7 +157,7 @@ def self.register_template_handler(extension, klass)
end
def initialize(base_path = nil, assigns_for_first_render = {}, controller = nil)#:nodoc:
- @base_path, @assigns = base_path, assigns_for_first_render.with_indifferent_access
+ @base_path, @assigns = base_path, assigns_for_first_render
@controller = controller
end

0 comments on commit 865874a

Please sign in to comment.