public
Rubygem
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-core.git
Slight refactoring of the partial method
carllerche (author)
Thu Jul 24 22:35:01 -0700 2008
commit  df7306d346d9ee721f15e3adb0367f0c188f2e66
tree    9c110235bd78b5b6c39a4336c6cc9d0cd036ce36
parent  088f956443e93d50d1b740e71b9454099efec73f
...
269
270
271
272
 
273
274
275
...
278
279
280
281
282
283
 
284
285
286
...
269
270
271
 
272
273
274
275
...
278
279
280
 
281
 
282
283
284
285
0
@@ -269,7 +269,7 @@ module Merb::RenderMixin
0
     with = [opts.delete(:with)].flatten
0
     as = opts.delete(:as) || template_location.match(%r[.*/_([^\.]*)])[1]
0
     
0
-    @_merb_partial_locals = opts.merge(:collection_index => 0, :collection_size => with.size)
0
+    @_merb_partial_locals = opts.merge(:collection_index => -1, :collection_size => with.size)
0
     
0
     # this handles an edge-case where the name of the partial is _foo.* and your opts
0
     # have :foo as a key.
0
@@ -278,9 +278,8 @@ module Merb::RenderMixin
0
     sent_template = with.map do |temp|
0
       @_merb_partial_locals[as.to_sym] = temp unless named_local
0
       if template_method && self.respond_to?(template_method)
0
-        sent = send(template_method)
0
         @_merb_partial_locals[:collection_index] += 1
0
-        sent
0
+        send(template_method)
0
       else
0
         raise TemplateNotFound, "Could not find template at #{template_location}.*"
0
       end

Comments