1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove unneeded ObjectWrapper class.

Was previously needed to work around the semantics of a deprecated (now removed) API to render :partial
This commit is contained in:
Michael Koziarski 2008-06-30 21:39:22 +03:00
parent efd18066a2
commit df36a6f759
3 changed files with 3 additions and 11 deletions

View file

@ -897,7 +897,7 @@ module ActionController #:nodoc:
else
render_for_text(
@template.send!(:render_partial, partial,
ActionView::Base::ObjectWrapper.new(options[:object]), options[:locals]), options[:status]
options[:object], options[:locals]), options[:status]
)
end

View file

@ -199,9 +199,6 @@ module ActionView #:nodoc:
cattr_reader :computed_public_paths
@@computed_public_paths = {}
class ObjectWrapper < Struct.new(:value) #:nodoc:
end
def self.helper_modules #:nodoc:
helpers = []
Dir.entries(File.expand_path("#{File.dirname(__FILE__)}/helpers")).sort.each do |file|
@ -253,7 +250,7 @@ module ActionView #:nodoc:
elsif options[:partial] && options[:collection]
render_partial_collection(options[:partial], options[:collection], options[:spacer_template], options[:locals], options[:as])
elsif options[:partial]
render_partial(options[:partial], ActionView::Base::ObjectWrapper.new(options[:object]), options[:locals])
render_partial(options[:partial], options[:object], options[:locals])
elsif options[:inline]
render_inline(options[:inline], options[:locals], options[:type])
end

View file

@ -42,12 +42,7 @@ module ActionView #:nodoc:
private
def add_object_to_local_assigns!(object)
@locals[:object] ||=
@locals[@variable_name] ||=
if object.is_a?(ActionView::Base::ObjectWrapper)
object.value
else
object
end || @view_controller.instance_variable_get("@#{variable_name}")
@locals[@variable_name] ||= object || @view_controller.instance_variable_get("@#{variable_name}")
@locals[as] ||= @locals[:object] if as
end