验证错误打印{{errors}}而不是真正的错误

时间:2011-03-29 05:58:54

标签: ruby-on-rails

从我下面升级了某些东西(不幸的是,我不确定是什么),验证错误现在打印出以下内容:

ActiveRecord::RecordInvalid: Validation failed: {{errors}}
    from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/validations.rb:1102:in `save_without_dirty!'
    from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/dirty.rb:87:in `save_without_transactions!'
    from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/transactions.rb:200:in `save!'
    from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
    from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/transactions.rb:182:in `transaction'
    from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/transactions.rb:200:in `save!'
    from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
    from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/transactions.rb:200:in `save!'
    from (irb):34
    from :0

我正在设置错误:

errors.add_to_base("outside edit window")

这曾经工作过,我做错了什么?这是在轨道2.3.8。

1 个答案:

答案 0 :(得分:1)

看到此链接解释问题;   https://github.com/svenfuchs/i18n/issues/71

你应该将你的i18n gem降级到0.3.3,或升级你的Rails版本> 2.3.8