Rails控制台总是返回Nil

时间:2015-04-23 19:12:17

标签: ruby-on-rails ruby console vagrant

RAILS_ENV=development rails c之后 rails console development 等...

我的控制台无法返回查询的任何值。当然,我有数据。 我正在使用vagrant和port_fowarding。

[20] pry(main)> User.first
  Empresa::Empresa Load (1.1ms)  SELECT  "empresas".* FROM "empresas" WHERE "empresas"."id" = $1 LIMIT 1  [["id", nil]]
  User Load (1.1ms)  SELECT  "usuarios".* FROM "usuarios" INNER JOIN "pessoas" ON "pessoas"."id" = "usuarios"."pessoa_id" AND "pessoas"."empresa_id" IS NULL WHERE (pessoas.empresa_id = NULL)  ORDER BY "usuarios"."id" ASC LIMIT 1
=> nil

无论如何,总是回归Nil。

0 个答案:

没有答案