Note: This was my first attempt at using openSUSE. On my second attempt, I no longer had this problem. My guess is that I installed the wrong version of something-or-other which caused this problem.
If you have openSUSE 11.1, like I do, then you have Ruby 1.8.7. I encountered an error when trying to run ruby script/console and ruby script/server for the first time in openSUSE. This pretty much killed everything — most of my plug-ins and models didn’t load.
activesupport-1.4.2/lib/active_support/core_ext/string/access.rb:43:in `first’:NoMethodError:
undefined method `[]‘ for #<Enumerable::Enumerator:0×7f1e1b77aa20>
The problem is that, in Ruby prior to 1.8.7 (perhaps much prior, I don’t know), the [] and/or first methods on String returned an array of characters. Now that has changed so that they return an Enumerable::Enumerator.
I added a hack to the top of /config/boot.rb so that it’d behave. I’ll figure out the real problem later — I’m busy! I found this example elsewhere, but I chose to but it in boot.rb:
unless '1.9'.respond_to?(:force_encoding)
puts 'un-defining :chars method on String for ruby 1.8.7 compatibility'
String.class_eval do
begin
remove_method :chars
rescue NameError
# OK
end
end
end
And unformatted:
unless ’1.9′.respond_to?(:force_encoding)
puts ’un-defining :chars method on String for ruby 1.8.7 compatibility’
String.class_eval do
begin
remove_method :chars
rescue NameError
# OK
end
end
end