Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All tests pass without memoizing view_context
- Loading branch information
Carlhuda
committed
Mar 18, 2010
1 parent
523d0f3
commit 71c9337
Showing
11 changed files
with
60 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,6 @@ def locale=(value) | |
module Rendering | ||
extend ActiveSupport::Concern | ||
|
||
include AbstractController::Assigns | ||
include AbstractController::ViewPaths | ||
|
||
# Overwrite process to setup I18n proxy. | ||
|
@@ -53,7 +52,8 @@ def process(*) #:nodoc: | |
# | ||
# Override this method in a module to change the default behavior. | ||
def view_context | ||
@_view_context ||= ActionView::Base.for_controller(self) | ||
klass = ActionView::Base.for_controller(self) | ||
klass.new(lookup_context, view_assigns, self) | ||
end | ||
|
||
# Normalize arguments, options and then delegates render_to_body and | ||
|
@@ -82,7 +82,6 @@ def render_to_string(options={}) | |
# Find and renders a template based on the options given. | ||
# :api: private | ||
def _render_template(options) #:nodoc: | ||
_evaluate_assigns(view_context) | ||
view_context.render(options) | ||
end | ||
|
||
|
@@ -105,6 +104,17 @@ def self.body_to_s(body) | |
|
||
private | ||
|
||
# This method should return a hash with assigns. | ||
# You can overwrite this configuration per controller. | ||
# :api: public | ||
def view_assigns | ||
hash = {} | ||
variables = instance_variable_names | ||
variables -= protected_instance_variables if respond_to?(:protected_instance_variables) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
foca
Contributor
|
||
variables.each { |name| hash[name.to_s[1..-1]] = instance_variable_get(name) } | ||
hash | ||
end | ||
|
||
# Normalize options by converting render "foo" to render :action => "foo" and | ||
# render "foo/bar" to render :file => "foo/bar". | ||
def _normalize_args(action=nil, options={}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I got an error today
stack trace shows the nil come from actionpack-3.0.0.beta3/lib/abstract_controller/rendering.rb:129:in `-'
maybe here need a guard? like: