[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

libgettext-ruby1.8: Breaks with Rails 2.1



Package: libgettext-ruby1.8
Version: 1.91.0-2
Severity: important
Tags: patch

Release team: The following bug report is, IMHO, non-invasive and
important enough for me to request a freeze exception so it can be
included in Lenny. Please comment.

gettext/rails.rb includes a call that breaks under Rails 2.1, the
version currently in both Lenny and Sid - In a gettext-based Rails
application, any action requested generates a "500 Internal Server
Error", with this being recorded in the log:

NoMethodError (undefined method `file_exists?' for #<ActionView::Base:0x7f93cd512260>):
    /usr/lib/ruby/1.8/gettext/rails.rb:281:in `render_file'
    /usr/lib/ruby/1.8/gettext/rails.rb:279:in `each'
    /usr/lib/ruby/1.8/gettext/rails.rb:279:in `render_file'

The error goes away if "freezing" the application to use a pre-2.1
Rails version.

This bug is referred in a blog message [1], which outlines the
solution:

diff --git a/lib/gettext/rails.rb b/lib/gettext/rails.rb
index 2ffd817..f18ee9f 100644
--- a/lib/gettext/rails.rb
+++ b/lib/gettext/rails.rb
@@ -271,6 +271,9 @@ end
 
 module ActionView #:nodoc:
   class Base #:nodoc:
+    # Needed for Rails >=2.1 compatibilty
+    delegate :file_exists?, :to => :finder unless respond_to?(:file_exists?)
+
     alias render_file_without_locale render_file #:nodoc:
     # This provides to find localized template files such as foo_ja.rhtml, foo_ja_JP.rhtml
     # instead of foo.rhtml. If the file isn't found, foo.rhtml is used.

[1] http://zargony.com/2008/02/12/edge-rails-and-gettext-undefined-method-file_exists-nomethoderror

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-vserver-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libgettext-ruby1.8 depends on:
ii  irb1.8                        1.8.7.72-1 Interactive Ruby (for Ruby 1.8)

libgettext-ruby1.8 recommends no packages.

Versions of packages libgettext-ruby1.8 suggests:
ii  libgettext-ruby-data          1.91.0-2   Data files for ruby gettext librar
ii  libgettext-ruby-util          1.91.0-2   Gettext utilities for ruby

-- no debconf information

-- 
Gunnar Wolf - gwolf@iiec.unam.mx - (+52-55)5623-0154 / 1451-2244
PGP key 1024D/8BB527AF 2001-10-23
Fingerprint: 0C79 D2D1 2C4E 9CE4 5973  F800 D80E F35A 8BB5 27AF


Reply to: