diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-27 11:44:18 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-27 11:44:18 +0000 |
commit | eec7cc004bebd7f7d70fa5e7106e46980d945e5f (patch) | |
tree | f53155cd54e3b4adcd910ca9a7d61fd6be62e433 /actionpack | |
parent | e95dd53a5d909338a8cf7720989d16b2620f78e2 (diff) | |
download | rails-eec7cc004bebd7f7d70fa5e7106e46980d945e5f.tar.gz rails-eec7cc004bebd7f7d70fa5e7106e46980d945e5f.tar.bz2 rails-eec7cc004bebd7f7d70fa5e7106e46980d945e5f.zip |
Fixed dynamic scaffolding [Stefan Kaes]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1940 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/scaffolding.rb | 13 | ||||
-rw-r--r-- | actionpack/lib/action_controller/templates/scaffolds/list.rhtml | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/scaffolding.rb b/actionpack/lib/action_controller/scaffolding.rb index 3d7223bedb..990ec3d2ea 100644 --- a/actionpack/lib/action_controller/scaffolding.rb +++ b/actionpack/lib/action_controller/scaffolding.rb @@ -146,21 +146,24 @@ module ActionController end private - def render#{suffix}_scaffold(action = caller_method_name(caller)) + def render#{suffix}_scaffold(action=nil) + action ||= caller_method_name(caller) + # logger.info ("testing template:" + "\#{self.class.controller_path}/\#{action}") if logger + if template_exists?("\#{self.class.controller_path}/\#{action}") - render(:action => action) + render_action(action) else @scaffold_class = #{class_name} @scaffold_singular_name, @scaffold_plural_name = "#{singular_name}", "#{plural_name}" @scaffold_suffix = "#{suffix}" add_instance_variables_to_assigns - @content_for_layout = @template.render_file(scaffold_path(action.sub(/#{suffix}$/, "")), false) + @template.instance_variable_set("@content_for_layout", @template.render_file(scaffold_path(action.sub(/#{suffix}$/, "")), false)) if !active_layout.nil? - render :file => active_layout, :use_full_path => true + render_file(active_layout, nil, true) else - render :file => scaffold_path("layout") + render_file(scaffold_path("layout")) end end end diff --git a/actionpack/lib/action_controller/templates/scaffolds/list.rhtml b/actionpack/lib/action_controller/templates/scaffolds/list.rhtml index d1196a1599..f0e36fdbfe 100644 --- a/actionpack/lib/action_controller/templates/scaffolds/list.rhtml +++ b/actionpack/lib/action_controller/templates/scaffolds/list.rhtml @@ -14,7 +14,7 @@ <% end %> <td><%= link_to "Show", :action => "show#{@scaffold_suffix}", :id => entry %></td> <td><%= link_to "Edit", :action => "edit#{@scaffold_suffix}", :id => entry %></td> - <td><%= link_to "Destroy", :action => "destroy#{@scaffold_suffix}", :id => entry, :confirm => "Are you sure?" %></td> + <td><%= link_to "Destroy", {:action => "destroy#{@scaffold_suffix}", :id => entry}, {:confirm => "Are you sure?"} %></td> </tr> <% end %> </table> |