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

Changeset 1940

Show
Ignore:
Timestamp:
07/27/05 11:44:18 (3 years ago)
Author:
david
Message:

Fixed dynamic scaffolding [Stefan Kaes]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/scaffolding.rb

    r1614 r1940  
    147147           
    148148          private 
    149             def render#{suffix}_scaffold(action = caller_method_name(caller)) 
     149            def render#{suffix}_scaffold(action=nil) 
     150              action ||= caller_method_name(caller) 
     151              # logger.info ("testing template:" + "\#{self.class.controller_path}/\#{action}") if logger 
     152               
    150153              if template_exists?("\#{self.class.controller_path}/\#{action}") 
    151                 render(:action => action) 
     154                render_action(action) 
    152155              else 
    153156                @scaffold_class = #{class_name} 
     
    156159                add_instance_variables_to_assigns 
    157160 
    158                 @content_for_layout = @template.render_file(scaffold_path(action.sub(/#{suffix}$/, "")), false
     161                @template.instance_variable_set("@content_for_layout", @template.render_file(scaffold_path(action.sub(/#{suffix}$/, "")), false)
    159162 
    160163                if !active_layout.nil? 
    161                   render :file => active_layout, :use_full_path => true 
     164                  render_file(active_layout, nil, true) 
    162165                else 
    163                   render :file => scaffold_path("layout"
     166                  render_file(scaffold_path("layout")
    164167                end 
    165168              end 
  • trunk/actionpack/lib/action_controller/templates/scaffolds/list.rhtml

    r1404 r1940  
    1515    <td><%= link_to "Show", :action => "show#{@scaffold_suffix}", :id => entry %></td> 
    1616    <td><%= link_to "Edit", :action => "edit#{@scaffold_suffix}", :id => entry %></td> 
    17     <td><%= link_to "Destroy", :action => "destroy#{@scaffold_suffix}", :id => entry, :confirm => "Are you sure?" %></td> 
     17    <td><%= link_to "Destroy", {:action => "destroy#{@scaffold_suffix}", :id => entry}, {:confirm => "Are you sure?"} %></td> 
    1818  </tr> 
    1919<% end %>