0

我正在使用 rails geocoder gem。我想覆盖

COMPASS_POINTS = %w[N NE E SE S SW W NW]

带有德国罗盘点:

COMPASS_POINTS = %w[N NO O SO S SW W NW]

但我不知道如何以及在哪里(config/gecoder.rb?)做到这一点?

任何帮助,将不胜感激!

4

1 回答 1

2

根据文件

 ##
    # Compass point names, listed clockwise starting at North.
    #
    # If you want bearings named using more, fewer, or different points
    # override Geocoder::Calculations.COMPASS_POINTS with your own array.
    #
    COMPASS_POINTS = %w[N NE E SE S SW W NW]

因此,创建一个初始化程序config/initializers/geocoder_override.rb并添加以下行:

Geocoder::Calculations::COMPASS_POINTS = %w[N NO O SO S SW W NW]
于 2018-06-16T08:46:01.830 回答