You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, I wanna be able to extend the Country class by my custom methods.
But it seems Ruby/Rails is taking the Country class from the gem and not from my models.
Creating a country.rb in my app/models directory with the following content:
require"countries/version"require'iso3166'require'countries/mongoid'ifdefined?(Mongoid)classCountry < ISO3166::Country@country_index=[]defto_sself.nameenddefsubdivision_index# my content hereputs"TEST"end
Calling
c = Country.search("AT")
c.subdivision_index
raises an error
c.subdivision_index
NoMethodError: undefined method `subdivision_index' for #<Country:0x007fe910800bc8>
Did you mean? subdivisions
How can I achieve that?
The reason is, that I wanna save all countries in a db and make them searchable via ElasticSearch.
Thank you!
The text was updated successfully, but these errors were encountered:
Hm it seems "countries" gem had some progress in the last years :-)
I am using a custom branch, with some subdivisions added by myself. In order to switch to the actual hexorx version all of these subdivisions should be merged into the "original" one (yours). Is that possible to make a pull request? (all my added stuff is conform to the one of hexorx)
Hi there, I wanna be able to extend the
Country
class by my custom methods.But it seems Ruby/Rails is taking the Country class from the gem and not from my models.
Creating a
country.rb
in myapp/models
directory with the following content:Calling
raises an error
How can I achieve that?
The reason is, that I wanna save all countries in a db and make them searchable via ElasticSearch.
Thank you!
The text was updated successfully, but these errors were encountered: