petrovich / petrovich-ruby

Petrovich, an inflector for Russian anthroponyms.
https://rubygems.org/gems/petrovich
MIT License
407 stars 34 forks source link

uninitialized constant Petrovich::Extension (NameError) #47

Closed ponchik closed 8 years ago

ponchik commented 8 years ago

После обновления до 1.0 ругается

/home/dimon/_projects/crm/app/models/user.rb:37:in `<class:User>': uninitialized constant Petrovich::Extension (NameError)
    from /home/dimon/_projects/crm/app/models/user.rb:35:in `<top (required)>'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.6/lib/active_support/inflector/methods.rb:261:in `const_get'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.6/lib/active_support/inflector/methods.rb:261:in `block in constantize'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.6/lib/active_support/inflector/methods.rb:259:in `each'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.6/lib/active_support/inflector/methods.rb:259:in `inject'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.6/lib/active_support/inflector/methods.rb:259:in `constantize'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/devise-3.5.6/lib/devise.rb:292:in `get'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/devise-3.5.6/lib/devise/mapping.rb:81:in `to'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/devise-3.5.6/lib/devise/mapping.rb:76:in `modules'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/devise-3.5.6/lib/devise/mapping.rb:93:in `routes'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/devise-3.5.6/lib/devise/mapping.rb:160:in `default_used_route'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/devise-3.5.6/lib/devise/mapping.rb:70:in `initialize'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/devise-3.5.6/lib/devise.rb:326:in `new'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/devise-3.5.6/lib/devise.rb:326:in `add_mapping'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/devise-3.5.6/lib/devise/rails/routes.rb:238:in `block in devise_for'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/devise-3.5.6/lib/devise/rails/routes.rb:237:in `each'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/devise-3.5.6/lib/devise/rails/routes.rb:237:in `devise_for'
    from /home/dimon/_projects/crm/config/routes.rb:16:in `block in <top (required)>'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:432:in `instance_exec'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:432:in `eval_block'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:410:in `draw'
    from /home/dimon/_projects/crm/config/routes.rb:3:in `<top (required)>'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/application/routes_reloader.rb:40:in `each'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/application/routes_reloader.rb:40:in `load_paths'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/application/routes_reloader.rb:16:in `reload!'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/application/routes_reloader.rb:26:in `block in updater'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.6/lib/active_support/file_update_checker.rb:75:in `execute'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/application/routes_reloader.rb:27:in `updater'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/dimon/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
    from /home/dimon/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /home/dimon/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /home/dimon/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /home/dimon/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each'
    from /home/dimon/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `call'
    from /home/dimon/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
    from /home/dimon/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
    from /home/dimon/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:194:in `public_send'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:194:in `method_missing'
    from /home/dimon/_projects/crm/config/environment.rb:6:in `<top (required)>'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/application.rb:328:in `require_environment!'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:142:in `require_application_and_environment!'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:67:in `console'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/dimon/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

При откате на 0.2.1 всё работает

tanraya commented 8 years ago

Мы убрали этот миксин из библиотеки. Если вы его используете, реализуйте его самостоятельно.

dustalov commented 8 years ago

@tanraya появление таких вопросов — признак того, что сломана обратная совместимость и нужно документировать пути обхода проблемы.

tanraya commented 8 years ago

@dustalov Мажорная версия библиотеки обновилась, так что потеря обратной совместимости это нормально.

dustalov commented 8 years ago

@tanraya программное обеспечение делаются ради людей. Давай напишем, как быть с этой проблемой.