aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Breedt <bitserf@gmail.com>2005-08-12 22:55:23 +0000
committerLeon Breedt <bitserf@gmail.com>2005-08-12 22:55:23 +0000
commitcbf709fc5c7725f64471980ca52f3f99d6bb568b (patch)
treeaf58d5bad1e7c3005b4bd44fc23dab2bc5720d7f
parent67f73c99dbd655c7ef6b71a0f0721902093ce855 (diff)
downloadrails-cbf709fc5c7725f64471980ca52f3f99d6bb568b.tar.gz
rails-cbf709fc5c7725f64471980ca52f3f99d6bb568b.tar.bz2
rails-cbf709fc5c7725f64471980ca52f3f99d6bb568b.zip
fix rendering of scaffolding (@content_for_layout has to be set on the template.)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1998 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionwebservice/lib/action_web_service/scaffolding.rb17
1 files changed, 13 insertions, 4 deletions
diff --git a/actionwebservice/lib/action_web_service/scaffolding.rb b/actionwebservice/lib/action_web_service/scaffolding.rb
index 3f0399405c..59fec0ef76 100644
--- a/actionwebservice/lib/action_web_service/scaffolding.rb
+++ b/actionwebservice/lib/action_web_service/scaffolding.rb
@@ -40,7 +40,7 @@ module ActionWebService
# 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 @@ module ActionWebService
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 @@ module ActionWebService
rescue_action(exception)
true
end
- END
+ end_eval
end
end