Changeset 1032

Show
Ignore:
Timestamp:
11/22/07 13:11:01 (1 year ago)
Author:
has.s..@gmail.com
Message:

Remove redundant locals setting in haml templates. Thanks nex3

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/merb/template/erubis.rb

    r1013 r1032  
    3434        return sent_template if sent_template 
    3535 
    36       end 
    37  
    38       def method_missing(sym, *args, &blk) 
    39         @_merb_partial_locals[sym] || @web_controller.send(sym, *args, &blk) 
    40       end 
    41        
     36      end       
    4237    end 
    4338     
  • trunk/lib/merb/template/haml.rb

    r765 r1032  
    3636           
    3737          begin  
    38             locals_code = build_locals(opts[:locals]) 
    39             opts[:locals] = {} 
     38 
     39            opts[:locals] = {} # Merb handles the locals 
    4040             
    4141            template = text ? text : load_template(file) 
    4242             
    43             haml = ::Haml::Engine.new("#{locals_code}#{template}", opts)  
     43            haml = ::Haml::Engine.new(template, opts)  
    4444            haml.to_html(view_context)  
    4545          rescue  
     
    6868            end 
    6969          end 
    70            
    71           def build_locals(locals) 
    72             locals_code = "" 
    73             if locals 
    74               locals.keys.each do |key| 
    75                 locals_code << "- #{key} = @_merb_partial_locals[:#{key}]\n" 
    76               end 
    77             end 
    78             locals_code 
    79           end 
    8070         
    8171          def cache_template?(path)