# Alias\_method\_chain with i18n

**URL:** <https://www.ruby-forum.com/t/alias-method-chain-with-i18n/192085>\
**Category:** Rails\
**Created:** [July 23, 2010, 2:17pm UTC](https://www.ruby-forum.com/t/alias-method-chain-with-i18n/192085 "2010-07-23T14:17:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pauloee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/d9b06d/32.png) [@pauloee](https://www.ruby-forum.com/u/pauloee)\
**Post date:** [July 23, 2010, 2:17pm UTC](https://www.ruby-forum.com/t/alias-method-chain-with-i18n/192085/1 "2010-07-23T14:17:48Z")

</div>

Hello,

I was investigating solutions for i18n with will\_paginate and I found  
a possible solution at

> **[久草av](http://lawrencesong.net/)**
>
> av5.net,久草av

The author adds to application\_helper.rb the following code:

#############################################  
include WillPaginate::ViewHelpers

def will\_paginate\_with\_i18n(collection, options = {})  
will\_paginate\_without\_i18n(collection, options.merge(:previous\_label  
=\> I18n.t(‘will\_paginate.previous’), :next\_label =\>  
I18n.t(‘will\_paginate.next’)))  
end

alias\_method\_chain :will\_paginate, :i18n  
#############################################

What I would like to understand is how this code is working, the  
“magic” behind it.

I’m also having a problem with this code with passenger. The code  
works fine with webrick but with passenger the program breaks at  
include WillPaginate::ViewHelpers with ‘uninitialized constant  
WillPaginate::ViewHelpers’ error. I tested it in the same environment.

Regards,

Paulo A.
