发布 :: 模型
class Post < ActiveRecord::Base
attr_accessible :body, :name, :no, :num
end
Posts.yml 下 (test/fixtures/)
one:
name: MyString
body: MyString
no: 1
num: 2
运行时rake test:units
,会生成以下堆栈跟踪
Error:
test_Post_for_correct_attributes(PostTest):
ActiveRecord::StatementInvalid: SQLite3::SQLException: table posts has no column named false: INSERT INTO "posts" ("name", "body", "false", "num", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', 1, 2, '2012-12-26 10:24:36', '2012-12-26 10:24:36', 980190962)
现在,这里 - 表字段“否”已转换为“假”。(这似乎是一个问题,因为它被解释为 FALSE 而不是对象变量)
将变量从 yaml 转换为对象的错误?
Rails 版本Rails 3.2.9
和 Rubyruby 1.9.3p194