# Globalize\_countries conflict

**URL:** <https://www.ruby-forum.com/t/globalize-countries-conflict/84191>\
**Category:** Rails I18n\
**Created:** [February 2, 2007, 5:32am UTC](https://www.ruby-forum.com/t/globalize-countries-conflict/84191 "2007-02-02T05:32:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ingoweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/77aa72/32.png) [@ingoweiss](https://www.ruby-forum.com/u/ingoweiss)\
**Post date:** [February 2, 2007, 5:32am UTC](https://www.ruby-forum.com/t/globalize-countries-conflict/84191/1 "2007-02-02T05:32:51Z")

</div>

Hi,

I just installed globalize and the problem is that I have a model  
‘Country’ which seems to conflict with globalize’s ‘Globalize::Country’  
model. Every time I use ‘Country’ now Rails assumes I mean  
Globalize::Country. How can I work around that?

Thanks!  
Ingo

---

<div class="post-metadata">

**Author:** ![ingoweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/77aa72/32.png) [@ingoweiss](https://www.ruby-forum.com/u/ingoweiss)\
**Post date:** [February 3, 2007, 3:06am UTC](https://www.ruby-forum.com/t/globalize-countries-conflict/84191/2 "2007-02-03T03:06:11Z")

</div>

Thanks for the reply! I got my app working by wrapping my Country model  
in a module like this MyApp::Country, and replacing all references to  
Country with MyApp::Country.

The only problem right now is that almost all my functional tests broke,  
I think because when I use the generated functions to load models from  
fixtures like ‘countries(:us)’, Rails tries to load it from  
Globalize::Countries. How can I tell Rails to use MyApp::Country in  
these functions, too?

Thanks!  
Ingo

Ingo W. wrote:

> Hi,
> 
> I just installed globalize and the problem is that I have a model  
> ‘Country’ which seems to conflict with globalize’s ‘Globalize::Country’  
> model. Every time I use ‘Country’ now Rails assumes I mean  
> Globalize::Country. How can I work around that?
> 
> Thanks!  
> Ingo

---

<div class="post-metadata">

**Author:** ![ingoweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/77aa72/32.png) [@ingoweiss](https://www.ruby-forum.com/u/ingoweiss)\
**Post date:** [August 1, 2007, 11:41pm UTC](https://www.ruby-forum.com/t/globalize-countries-conflict/84191/3 "2007-08-01T23:41:07Z")

</div>

Ingo W. wrote:

> Thanks for the reply! I got my app working by wrapping my Country model  
> in a module like this MyApp::Country, and replacing all references to  
> Country with MyApp::Country.

Hi,

I am experiencing the same problem and havn’t figured out yet how to  
point a _belongs\_to_ to the _moduled_ model.

The obvious approach …

module MyApp  
class Country \< ActiveRecord::Base  
end  
end

class Person  
belongs\_to :country, :class\_name =\> ‘MyApp::Country’  
end

… sadly doesn’t work.

---

<div class="post-metadata">

**Author:** ![ingoweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/77aa72/32.png) [@ingoweiss](https://www.ruby-forum.com/u/ingoweiss)\
**Post date:** [November 29, 2007, 8:09am UTC](https://www.ruby-forum.com/t/globalize-countries-conflict/84191/4 "2007-11-29T08:09:00Z")

</div>

I had the same problem … I fixed it without wrapping my model in a  
module.

[http://blog.commonthread.com/2007/11/28/globalize-hijacked-my-country](http://blog.commonthread.com/2007/11/28/globalize-hijacked-my-country)

Philipp H. wrote:

> Ingo W. wrote:
> 
> > Thanks for the reply! I got my app working by wrapping my Country model  
> > in a module like this MyApp::Country, and replacing all references to  
> > Country with MyApp::Country.
> 
> Hi,
> 
> I am experiencing the same problem and havn’t figured out yet how to  
> point a _belongs\_to_ to the _moduled_ model.
> 
> The obvious approach …
> 
> module MyApp  
> class Country \< ActiveRecord::Base  
> end  
> end
> 
> class Person  
> belongs\_to :country, :class\_name =\> ‘MyApp::Country’  
> end
> 
> … sadly doesn’t work.
