From 28ce07b1dd5664f6706ce6aad455132787730b25 Mon Sep 17 00:00:00 2001 From: Holger Just Date: Sat, 26 Nov 2011 16:09:08 +0100 Subject: [PATCH] [#734] Force instance_variables to string for Ruby 1.9 compatibility --- app/helpers/application_helper.rb | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f621138c..73bfc5aa 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1029,17 +1029,14 @@ module ApplicationHelper end def get_view_instance_variables_for_liquid - self.instance_variables.reject do |ivar| - ivar.match(/@_/) || # Rails "internal" variables: @_foo - ivar.match(/@template/) || - ivar == '@output_buffer' || - ivar == '@cookies' || - ivar == '@helpers' || - ivar == '@real_format' || - ivar == '@assigns_added' || - ivar == '@assigns' || - ivar == '@view_paths' || - ivar == '@controller' + internal_variables = %w{ + @output_buffer @cookies @helpers @real_format @assigns_added @assigns + @view_paths @controller + } + self.instance_variables.collect(&:to_s).reject do |ivar| + ivar.match(/^@_/) || # Rails "internal" variables: @_foo + ivar.match(/^@template/) || + internal_variables.include?(ivar) end.inject({}) do |acc,ivar| acc[ivar.sub('@','')] = instance_variable_get(ivar) acc