Browse files

fix rendering of scaffolding (@content_for_layout has to be set on th…

…e template.)

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1998 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 67f73c9 commit cbf709fc5c7725f64471980ca52f3f99d6bb568b @bitserf bitserf committed Aug 12, 2005
Showing with 13 additions and 4 deletions.
  1. +13 −4 actionwebservice/lib/action_web_service/scaffolding.rb
View
17 actionwebservice/lib/action_web_service/scaffolding.rb
@@ -40,7 +40,7 @@ module ClassMethods
# can then be used as the entry point for invoking API methods from a web browser.
def web_service_scaffold(action_name)
add_template_helper(Helpers)
- module_eval <<-END, __FILE__, __LINE__
+ module_eval <<-"end_eval", __FILE__, __LINE__
def #{action_name}
if request.method == :get
setup_invocation_assigns
@@ -112,8 +112,17 @@ def setup_invocation_assigns
def render_invocation_scaffold(action)
customized_template = "\#{self.class.controller_path}/#{action_name}/\#{action}"
default_template = scaffold_path(action)
- @content_for_layout = template_exists?(customized_template) ? @template.render_file(customized_template) : @template.render_file(default_template, false)
- self.active_layout ? render_file(self.active_layout, "200 OK", true) : render_file(scaffold_path("layout"))
+ if template_exists?(customized_template)
+ content = @template.render_file(customized_template)
+ else
+ content = @template.render_file(default_template, false)
+ end
+ @template.instance_variable_set("@content_for_layout", content)
+ if self.active_layout.nil?
+ render_file(scaffold_path("layout"))
+ else
+ render_file(self.active_layout, "200 OK", true)
+ end
end
def scaffold_path(template_name)
@@ -159,7 +168,7 @@ def handle_invocation_exception(obj)
rescue_action(exception)
true
end
- END
+ end_eval
end
end

0 comments on commit cbf709f

Please sign in to comment.