【发布时间】:2014-08-12 08:20:19
【问题描述】:
我刚刚将我的应用升级到 Rails 4,我的几个 RSpec 规范现在都失败了,所有这些都以同样的方式。
SQL (82.3ms) INSERT INTO "profiles" ("career_goal", "created_at", "email", "encrypted_password", "first_name", "gpa", "grad_year", "hidden", "keywords", "kind", "last_name", "major_names", "middle_name", "minor_names", "phone", "id", "research_interest", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["career_goal", ["Illum et sunt.", "Illo sapiente nesciunt reiciendis nulla fugit est autem."]], ["created_at", Sat, 21 Jun 2014 15:12:40 PDT -07:00], ["email", "madonna@huels.name"], ["encrypted_password", "$2a$10$y1zijhGouDy1OT4qHGnXR./FvXP9T7DHHvu4BofAt5ZBJrqjFisty"], ["first_name", "Jayde"], ["gpa", #<BigDecimal:e684850,'0.25E1',18(36)>], ["grad_year", 2013], ["hidden", false], ["keywords", "Daisha Ea placeat debitis repellendus autem ad voluptas. Illum et sunt. Illo sapiente nesciunt reiciendis nulla fugit est autem. "], ["kind", "student"], ["last_name", "Reilly"], ["major_names", "Anthropology"], ["middle_name", "Daisha"], ["minor_names", "Sociology"], ["phone", "724-953-4023 x4372"], ["id", "01234567"], ["research_interest", "Ea placeat debitis repellendus autem ad voluptas."], ["updated_at", Sat, 21 Jun 2014 15:12:40 PDT -07:00]]
TypeError: can't cast Array to text: INSERT INTO "profiles" ("career_goal", "created_at", "email", "encrypted_password", "first_name", "gpa", "grad_year", "hidden", "keywords", "kind", "last_name", "major_names", "middle_name", "minor_names", "phone", "id", "research_interest", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
现在INSERT INTO "profiles" ("fields", etc) VALUES (?,?,?) 的 for 中的 SQL 调用似乎格式不正确,任何关于为什么 VALUES 部分都是 ?s 的见解将不胜感激。我检查了我对 :profile 的定义,这似乎不是我在其他地方读到的 Faker 问题。 (我有Faker::Lorem.words(4).join('-'),它没有提供数组或任何东西。这是一个 Active Record 问题吗?还有其他地方我应该寻找错误或需要重新配置的东西吗?
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-4 rspec factory-bot