Rails ActiveSupport NoMethodError из unicode.rb
В моем проекте rails 3.2.15 я получаю противоречивые ошибки в моих спецификациях active_support/multibyte/unicode.rb
, Иногда спецификации терпят неудачу, иногда они проходят. Я не видел это вне тестов, все же. Это каждый раз в одной и той же области кода. Кажется, это та область, где загружается ActiveSupport unicode_tables.dat
, Что еще более озадачивает, так это то, что если я зайду в ActiveSupport к рассматриваемой строке и добавлю к ней p
чтобы вывести значения, он на самом деле проходит там, где он потерпел неудачу раньше и терпит неудачу дальше. FriendlyId находится в стеке, поэтому мне интересно, имеет ли это какое-либо отношение к проблеме. Строка в моем коде, которая вызывает исключение, просто update_attributes!(:pdf_processing => false)
, Что мне не хватает?
NoMethodError:
undefined method `each' for nil:NilClass
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/multibyte/unicode.rb:350:in `load'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/multibyte/unicode.rb:335:in `codepoints'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/multibyte/unicode.rb:158:in `block in decompose_codepoints'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/multibyte/unicode.rb:147:in `each'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/multibyte/unicode.rb:147:in `inject'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/multibyte/unicode.rb:147:in `decompose_codepoints'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/multibyte/unicode.rb:291:in `normalize'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/inflector/transliterate.rb:62:in `transliterate'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/inflector/transliterate.rb:84:in `parameterize'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/core_ext/string/inflections.rb:155:in `parameterize'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/friendly_id-4.0.10.1/lib/friendly_id/slugged.rb:245:in `normalize_friendly_id'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/friendly_id-4.0.10.1/lib/friendly_id/slugged.rb:262:in `should_generate_new_friendly_id?'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/friendly_id-4.0.10.1/lib/friendly_id/slugged.rb:273:in `set_slug'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:407:in `_run__895003607475416689__validation__177331951454965097__callbacks'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:405:in `__run_callback'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:385:in `_run_validation_callbacks'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:81:in `run_callbacks'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activemodel-3.2.15/lib/active_model/validations/callbacks.rb:53:in `run_validations!'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activemodel-3.2.15/lib/active_model/validations.rb:195:in `valid?'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/validations.rb:69:in `valid?'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/validations.rb:77:in `perform_validations'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/validations.rb:56:in `save!'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/attribute_methods/dirty.rb:33:in `save!'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:264:in `block in save!'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:208:in `transaction'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:264:in `save!'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/persistence.rb:228:in `block in update_attributes!'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:208:in `transaction'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/persistence.rb:226:in `update_attributes!'
# ./app/models/campaign.rb:291:in `ensure in generate_pdf'
# ./app/models/campaign.rb:291:in `generate_pdf'
# ./spec/models/campaign/generate_pdf_spec.rb:53:in `block (3 levels) in <top (required)>'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:114:in `instance_eval'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:114:in `block in run'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:254:in `with_around_each_hooks'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:111:in `run'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:390:in `block in run_examples'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:386:in `map'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:386:in `run_examples'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:371:in `run'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:372:in `block in run'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:372:in `map'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:372:in `run'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:28:in `map'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:28:in `block in run'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/reporter.rb:58:in `report'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:25:in `run'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/test_framework/rspec.rb:11:in `run_tests'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:13:in `block in run'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/forker.rb:21:in `block in initialize'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/forker.rb:18:in `fork'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/forker.rb:18:in `initialize'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:9:in `new'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:9:in `run'
# /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/server.rb:48:in `run'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
# /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'