Upgrade to Rails 2.2.0
As a side benefit, fix an (non-user-visible) bug in display_s5(). Also fixed a bug where removing orphaned pages did not expire cached summary pages.
This commit is contained in:
parent
39348c65c2
commit
7600aef48b
827 changed files with 123652 additions and 11027 deletions
48
vendor/rails/actionpack/lib/action_view/renderable_partial.rb
vendored
Normal file
48
vendor/rails/actionpack/lib/action_view/renderable_partial.rb
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
module ActionView
|
||||
# NOTE: The template that this mixin is being included into is frozen
|
||||
# so you cannot set or modify any instance variables
|
||||
module RenderablePartial #:nodoc:
|
||||
extend ActiveSupport::Memoizable
|
||||
|
||||
def variable_name
|
||||
name.sub(/\A_/, '').to_sym
|
||||
end
|
||||
memoize :variable_name
|
||||
|
||||
def counter_name
|
||||
"#{variable_name}_counter".to_sym
|
||||
end
|
||||
memoize :counter_name
|
||||
|
||||
def render(view, local_assigns = {})
|
||||
if defined? ActionController
|
||||
ActionController::Base.benchmark("Rendered #{path_without_format_and_extension}", Logger::DEBUG, false) do
|
||||
super
|
||||
end
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
def render_partial(view, object = nil, local_assigns = {}, as = nil)
|
||||
object ||= local_assigns[:object] ||
|
||||
local_assigns[variable_name]
|
||||
|
||||
if view.respond_to?(:controller)
|
||||
ivar = :"@#{variable_name}"
|
||||
object ||=
|
||||
if view.controller.instance_variable_defined?(ivar)
|
||||
ActiveSupport::Deprecation::DeprecatedObjectProxy.new(
|
||||
view.controller.instance_variable_get(ivar),
|
||||
"#{ivar} will no longer be implicitly assigned to #{variable_name}")
|
||||
end
|
||||
end
|
||||
|
||||
# Ensure correct object is reassigned to other accessors
|
||||
local_assigns[:object] = local_assigns[variable_name] = object
|
||||
local_assigns[as] = object if as
|
||||
|
||||
render_template(view, local_assigns)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue