我将Rails从4.2.5.1升级到4.2.7.1,现在由于活动记录更改,我的一些测试失败了:
2) HotelShell all room types have default and english description
Failure/Error: @hotel_shell.save!
ActiveRecord::RecordInvalid:
Validation failed: %%Room types %is invalid, %Room types %is invalid, %Room types %is invalid, %Room types %is invalid, %Room types %is invalid, %Room types %is invalid, %Room types %is invalid, %Room types %is invalid, %Room types %is invalid, %Room types %is invalid, %Room types %is invalid, %Room types %is invalid, %Room types %is invalid, %Room types %is invalid, %Room types %is invalid, %Room types %is invalid, %Room types %is invalid, %Room types %is invalid
# /home/mshazad/.rvm/gems/ruby-2.3.3/gems/activerecord-4.2.7/lib/active_record/validations.rb:79:in `raise_record_invalid'
# /home/mshazad/.rvm/gems/ruby-2.3.3/gems/activerecord-4.2.7/lib/active_record/validations.rb:43:in `save!'
# /home/mshazad/.rvm/gems/ruby-2.3.3/gems/activerecord-4.2.7/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
# /home/mshazad/.rvm/gems/ruby-2.3.3/gems/activerecord-4.2.7/lib/active_record/transactions.rb:291:in `block in save!'
# /home/mshazad/.rvm/gems/ruby-2.3.3/gems/activerecord-4.2.7/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
# /home/mshazad/.rvm/gems/ruby-2.3.3/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
# /home/mshazad/.rvm/gems/ruby-2.3.3/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
# /home/mshazad/.rvm/gems/ruby-2.3.3/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
# /home/mshazad/.rvm/gems/ruby-2.3.3/gems/activerecord-4.2.7/lib/active_record/transactions.rb:220:in `transaction'
# /home/mshazad/.rvm/gems/ruby-2.3.3/gems/activerecord-4.2.7/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
# /home/mshazad/.rvm/gems/ruby-2.3.3/gems/activerecord-4.2.7/lib/active_record/transactions.rb:291:in `save!'
# ./spec/factories/complete_factory_spec.rb:8:in `block (2 levels) in <top (required)>'
有人知道ActiveRecord的两个版本之间发生了什么变化以及我需要在代码中进行哪些更改以符合此要求吗?
由于升级,我有其他一些测试失败,但是通过为这些gem指定较旧的版本,此问题得以解决。不幸的是,由于存在此漏洞,我无法针对ActiveRecord进行此操作:
SQL Injection General Rails 4.2.5.1 contains a SQL injection vulnerability (CVE-2016-6317). Upgrade to 4.2.7.1 near line 234 High