为什么没有Rails的" errors.full_messages"替换属性和消息变量? [英] Why doesn't Rails' "errors.full_messages" replace attribute and message variables?

查看:368
本文介绍了为什么没有Rails的" errors.full_messages"替换属性和消息变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个奇怪的问题,我刚刚创建了一个滑轨模型。

Having a strange problem with a rails model I just created.

下面是我的验证:

validates_presence_of :from_name, :message => 'Please provide a from name.'
validates_presence_of :from_email
validates_presence_of :giftition_plan_id

我在使用的问题 errors.full_messages 以及 f.error_messages 在我的表格:

g = Giftition.create
g.errors.first
=> ["from_name", "Please provide a from name."]
>> g.errors.full_messages
=> ["{{attribute}} {{message}}", "{{attribute}} {{message}}", "{{attribute}} {{message}}"]

我刚开始{{}属性} {{消息}}。任何想法?

更新:我已经卸载了轨道3,所有已经安装了它,这使问题的宝石消失。这不是一个修复,但...我还是想有导轨3安装。

UPDATE: I've uninstalled rails 3 and all the gems that were installed with it and that made the problem go away. It's not a fix though... I would still like to have rails 3 installed.

更新:听起来好像升级到2.3.9修复了问题。不幸的是,我已经放弃了现在,而且在将来某个时候我会尽力的。

UPDATE: Sounds like upgrading to 2.3.9 fixes the problem. Unfortunately, I've given up for now, but sometime in the future I will try that.

推荐答案

升级到版本2.3.9轨修复这个问题。

Upgrading to Version rails 2.3.9 fixes this problem

gem install -v 2.3.9 rails --include-dependencies

编辑:

您还需要编辑配置\的environment.rb 文件来修改 RAILS_GEM_VERSION

You also need to edit the config\environment.rb file to change the RAILS_GEM_VERSION.

RAILS_GEM_VERSION = '2.3.9'

编辑#2:

我要指出,2.3.9版本不是2.3.X分支的最新版本,您应该升级了最新版本。

I should note that version 2.3.9 is not the latest version of the 2.3.X branch, and you should upgrade the the latest version available.

这篇关于为什么没有Rails的" errors.full_messages"替换属性和消息变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆