Forum: Ruby on Rails Globalize plugin, now I have two classes with the same name

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Estelle W. (Guest)
on 2006-02-06 22:36
(Received via mailing list)
Hi, newbie here.

I'm using the Globalize plugin, which defines a model with the same
name as one of my existing models.  We both use a model called
Country.  The Globalize Country model (within vendors/...) is wrapped
in module like this...

module Globalize
  class Country < ActiveRecord::Base

And this is my Country model (within app/models)...

class Country < ActiveRecord::Base
  has_many :addresses

I'm not sure how to deal with this situation.  My country table has a
couple of fields that are unique, so I want to keep this information
in the database (whether it be combined with the globalize_countries
table, or maintained in a separate countries table).  Also, I want to
define my own class/instance methods etc and obviously I want to put
these in my own model, completely separate from the Globalize plugin.
But currently Country.find is invoking the Globalize Country class
rather than my own.

Can someone explain how I can deal with this situation as cleanly as

This topic is locked and can not be replied to.