After updating to the latest edge Rails via SVN today, my local development webserver suddenly started to respond with a 500 application error for every request. The mongrel console revealed:
NoMethodError (undefined method `file_exists?' for #<ActionView::Base:0x2aaaac3eee10>): /usr/lib64/ruby/gems/1.8/gems/gettext-1.90.0/lib/gettext/rails.rb:280:in `render_file' /usr/lib64/ruby/gems/1.8/gems/gettext-1.90.0/lib/gettext/rails.rb:278:in `each' /usr/lib64/ruby/gems/1.8/gems/gettext-1.90.0/lib/gettext/rails.rb:278:in `render_file' /vendor/rails/actionpack/lib/action_controller/base.rb:1107:in `render_for_file' /vendor/rails/actionpack/lib/action_controller/base.rb:841:in `render_with_no_layout' : :
Digging deeper, I found out that the method
ActionView::Base#file_exists? has been moved to a different place in Rails' Changeset 8683. Fortunately, fixing it is easy.
As a workaround until either rails or gettext is fixed, you can simply drop the following lines somewhere into your rails application (e.g. I added it to
config/initializers/gettext.rb, which I use to pull in gettext support):
module ActionView class Base delegate :file_exists?, :to => :finder unless respond_to?(:file_exists?) end end
This snippet adds the method
ActionView::Base if it doesn't exist and delegates calls to it to the finder (which is the place where this method has been moved to in newer rails versions).
Update: Issue reported as ruby-gettext bug #17990.
Update 2008-06-18: In a recent commit, the ActionView::Base#file_exists? method was added again, so the above workaround isn't necessary anymore for Edge Rails and probably Rails 2.1.
Update 2008-08-07: Looks like something was changed again before Rails 2.1 was released. With Rails 2.1, this workaround is still necessary to use gettext.