# Undefined method 'clear'

**URL:** <https://www.ruby-forum.com/t/undefined-method-clear/194565>\
**Category:** Rails I18n\
**Created:** [September 7, 2010, 8:52am UTC](https://www.ruby-forum.com/t/undefined-method-clear/194565 "2010-09-07T08:52:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebastian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@sebastian](https://www.ruby-forum.com/u/sebastian)\
**Post date:** [September 7, 2010, 8:52am UTC](https://www.ruby-forum.com/t/undefined-method-clear/194565/1 "2010-09-07T08:52:52Z")

</div>

Hi folks.

I tried to get Rails I18n running with gettext, but without success.  
I’m using Rails 2.3.8, i18n 0.4.1 and gettext 2.1.0.

I added the following lines to environment.rb:

config.gem “locale”  
config.gem “locale\_rails”  
config.gem “gettext”  
config.gem “gettext\_activerecord”  
config.gem “gettext\_rails”  
config.i18n.default\_locale = :de

To the application controller I added:

init\_gettext “my\_app”

I set up the remaining things (rake tasks to generate and update po/mo  
files). Fired up the server getting this result when trying to visit  
any page:

NoMethodError in StaticController#index

undefined method `clear’ for I18n::Locale:Module

/Library/Ruby/Gems/1.8/gems/locale\_rails-2.0.5/lib/locale\_rails/  
i18n.rb:34:in `locale=' /Library/Ruby/Gems/1.8/gems/locale_rails-2.0.5/lib/locale_rails/ action_controller/base.rb:43:in`init\_locale’  
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active\_support/  
callbacks.rb:178:in `send’  
…  
…

Any ideas what’s going wrong?

Thanks for your help in advance.

Sebastian

---

<div class="post-metadata">

**Author:** ![sebastian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@sebastian](https://www.ruby-forum.com/u/sebastian)\
**Post date:** [September 16, 2010, 12:25pm UTC](https://www.ruby-forum.com/t/undefined-method-clear/194565/2 "2010-09-16T12:25:33Z")

</div>

Hi Sebastian,

I had the same problem and I found the solution here:  
[https://rubyforge.org/tracker/index.php?func=detail&aid=28239&group\_id=1997&atid=7805](https://rubyforge.org/tracker/index.php?func=detail&aid=28239&group_id=1997&atid=7805)

Waiting for a locale\_rails gem \> 2.0.5, that maybe will include the fix,  
I just replaced directly this file:

> <https://github.com/mutoh/locale_rails/blob/2bad60660127683c259fe/lib/locale_rails/i18n.rb>

where basically each relative Locale reference is now absolute as  
::Locale

Bye  
Franco S.
