0

New to Rails and Ruby on Rails,

the code in file /host_share/my_application/config/initializers/countries.rb

Carmen.priority_countries = %w(US CA MX)
Carmen.excluded_countries = ["AC", "AF", "AX", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", 
                               "AZ", "BS", "BH", "BD", "BB", "BY", "BZ", "BJ", "BL", "BM", "BT", "BO", "BA", "BW", "BV", 
                               "BR", "IO", "BN", "BG", "BF", "BI", "BQ", "KH", "CM", "CV", "KY", "CF", "TD", "CL", "CN", 
                               "CX", "CC", "CO", "KM", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CW", "DJ", 
                               "DM", "DO", "EC", "EG", "SV", "GQ", "ER", "EE", "ET",  "FO", "FJ", "GF", 
                               "PF", "TF", "GA", "GM", "GE", "GH", "GI", "GD", "GP", "GU", "GT", "GG", 
                               "GN", "GW", "GY", "HT", "HM", "VA", "HN", "HK", "HU", "IN", "ID", "IR", "IQ", 
                               "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KP", "KR", "KV", "KW", "KG", 
                               "LA", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "MO", "MK", "MG", "MW", "MY", "MV", 
                               "ML", "MT", "MH", "MQ", "MR", "MU", "YT", "FM", "MD", "MN", "MF", "ME", "MA", 
                               "MZ", "MM", "NA", "NR", "NP", "AN", "NC", "NZ", "NI", "NE", "NG", "NU", "NF", "MP", 
                               "NO", "OM", "PK", "PW", "PS", "PA", "PG", "PY", "PE", "PH", "PN", "QA", 
                               "RE", "RO", "RU", "RW", "SH", "KN", "LC", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS", 
                               "SC", "SL", "SG", "SK", "SI", "SB", "SO", "ZA", "GS", "LK", "SD", "SR", "SJ", "SZ", 
                               "SX", "SY", "TW", "TJ", "TZ", "TH", "TL", "TG", "TK", "TO", "TT", "TN", "TR", "TM", 
                               "TC", "TV", "UG", "UA", "AE", "UM", "UY", "UZ", "VU", "VE", "VN", 
                               "WF", "EH", "YE", "ZM", "ZW", "SS", "TA"]

trying to upgrade old rails 3.2.19 application to 4.0.13 (latest of 4.0.x), after doing all required changes in code my application gets stuck at

/host_share/my_application/config/initializers/countries.rb:4:in `<top (required)>': undefined method `priority_countries=' for Carmen:Module (NoMethodError)
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:223:in `load'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:223:in `block in load'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:214:in `load_dependency'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:223:in `load'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.13/lib/rails/engine.rb:609:in `block (2 levels) in <class:Engine>'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.13/lib/rails/engine.rb:608:in `each'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.13/lib/rails/engine.rb:608:in `block in <class:Engine>'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.13/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.13/lib/rails/initializable.rb:30:in `run'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.13/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/vagrant/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
    from /home/vagrant/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
    from /home/vagrant/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from'
    from /home/vagrant/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
    from /home/vagrant/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:209:in `block in each_strongly_connected_component_from'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.13/lib/rails/initializable.rb:44:in `each'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.13/lib/rails/initializable.rb:44:in `tsort_each_child'
    from /home/vagrant/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:203:in `each_strongly_connected_component_from'
    from /home/vagrant/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
    from /home/vagrant/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:180:in `each'
    from /home/vagrant/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
    from /home/vagrant/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.13/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.13/lib/rails/application.rb:215:in `initialize!'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /host_share/my_application/config/environment.rb:5:in `<top (required)>'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:229:in `require'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:229:in `block in require'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:214:in `load_dependency'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:229:in `require'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.13/lib/rails/application.rb:189:in `require_environment!'
    from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.13/lib/rails/commands.rb:44:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

UPDATE: This code Carmen.priority_countries is the part of carmen version 0.2.8 and not anymore supported in latest version,

So the new question is how do I change my code to make it work accordingly?

riksof-zeeshan
  • 531
  • 9
  • 27
  • `/config/initializers/countries.rb` at line number 4, you have a method called as `priority_countries=`, is it defined anywhere ? – dp7 Nov 11 '16 at 11:39
  • I just googled for Carmen, and I found this https://github.com/jim/carmen-rails which is for rails 3.x, perhaps you have that, it is not maintained anymore. And I found this https://github.com/jim/carmen, which is for rails 4, perhaps you need to make some changes to your code and start using the new gem, – fanta Nov 11 '16 at 11:41
  • @dkp I'm not sure about that, in my understanding this should be part of Carmen library, – riksof-zeeshan Nov 11 '16 at 11:51
  • @fanta I already have `gem "carmen"` in my GemFile – riksof-zeeshan Nov 11 '16 at 11:53

0 Answers0