Hi, At Sat, 5 May 2007 02:51:57 +0900, Michael Dotterer wrote in [ruby-core:11090]: > Using String#to_date (which calls parsedate) raises the message "can't modify frozen string" > > Trace: > > c:/ruby/lib/ruby/1.8/date/format.rb:105:in `chomp!' > c:/ruby/lib/ruby/1.8/date/format.rb:105:in `method_missing' > c:/ruby/lib/ruby/1.8/date/format.rb:963:in `_parse' > c:/ruby/lib/ruby/1.8/parsedate.rb:47:in `parsedate' > #{RAILS_ROOT}/vendor/rails/activesupport/lib/active_support/core_ext/string/conversions.rb:14:in `to_date' > ... > > I was unable to reproduce the error using irb. Seems activesupport uses #send with a frozen string to invoke conversion method. I guess method_missing should not modify its arguments.
Index: lib/date/format.rb =================================================================== --- lib/date/format.rb (revision 12239) +++ lib/date/format.rb (working copy) @@ -119,5 +119,5 @@ class Date def method_missing(t, *args, &block) - t = t.to_s + t = "#{t}" set = t.chomp!('=') t = t.intern
-- Nobu Nakada