Changeset 730

Show
Ignore:
Timestamp:
10/08/07 01:30:56 (1 year ago)
Author:
wyca..@gmail.com
Message:

I now save and protect the @_obj and @_block variables that I set for the block call

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/merb_helpers/lib/form_helpers.rb

    r729 r730  
    2020      def form_for(obj, &block) 
    2121        concat("<form>", block.binding) 
    22         self.instance_eval do 
    23           @obj = instance_variable_get("@#{obj}") 
    24           @object_name = obj 
    25           @block = block 
    26           block.call 
    27         end 
    28         concat("</form>", block.binding)         
     22         
     23        old_obj, @_obj = @_obj, instance_variable_get("@#{obj}") 
     24        @_object_name = obj 
     25        old_block, @_block = @_block, block 
     26         
     27        block.call 
     28         
     29        concat("</form>", block.binding) 
     30        @_obj, @_block = old_obj, old_block 
    2931      end 
    3032       
    3133      def text_control(col) 
    32         concat("<input type='text' name='#{@object_name}[#{col}]' value='#{@obj.send(col)}'/>", @block.binding) 
     34        concat("<input type='text' name='#{@_object_name}[#{col}]' value='#{@_obj.send(col)}'/>", @_block.binding) 
    3335      end 
    3436