Modified: trunk/config/environment.rb (2811 => 2812)
--- trunk/config/environment.rb 2011-11-16 15:07:04 UTC (rev 2811)
+++ trunk/config/environment.rb 2011-11-16 15:36:04 UTC (rev 2812)
@@ -113,13 +113,15 @@
load 'config/environment_private.rb' if FileTest.exist?('config/environment_private.rb')
# Fix for Ruby 1.8.7 when using Rails < 2.2
-module ActionView
- module Helpers
- module TextHelper
- def truncate(text, length = 30, truncate_string = "...")
- if text.nil? then return end
- l = length - truncate_string.chars.to_a.size
- (text.chars.to_a.size > length ? text.chars.to_a[0...l].join + truncate_string : text).to_s
+if RUBY_VERSION == "1.8.7" && ((RAILS::VERSION::MAJOR == 1) || (RAILS::VERSION::MAJOR == 2 && RAILS::VERSION::MINOR < 2))
+ module ActionView
+ module Helpers
+ module TextHelper
+ def truncate(text, length = 30, truncate_string = "...")
+ if text.nil? then return end
+ l = length - truncate_string.chars.to_a.size
+ (text.chars.to_a.size > length ? text.chars.to_a[0...l].join + truncate_string : text).to_s
+ end
end
end
end