我是在轨道环境中的红宝石新手。 我使用seeds.rb
将我的数据库与数据一起迁移到heroku。在heroku服务器上运行TableName.all
填充heroku postgres中的所有数据。当我尝试像heroku控制台明显不工作
TableName.select("Distinct(Category)")
运行命令我得到错误
Column TableName.Category does not exist.
我尝试了变化列,但没有奏效。请让我知道这里出了什么问题。
在此先感谢
编辑
在我的dev的服务器其工作正常。在开发网站上没有问题。我使用的开发站点
编辑**
这里SQLite是从续集文本:
#rails console
>>Recall.all
SELECT "recalls".* From "recalls"
=>[#<Recall id:1, Category: "******",......>]
>>Recall.select("Distinct(Category)")
SELECT DISTINCT(Category) From recalls
=>[#<Recall Category: "Foods">,#<Recall Category: "Consumer Products">]
#heroku run console
>>Recall.all
SELECT "recalls".* From "recalls"
=><Recall id:1, Category: "******",......>
>>Recall.select("Distinct(Category)")
Recall Load <2.5ms> SELECT DISTINCT(Category) FROM "recalls"
PGError: ERROR: column "category" does not exist
LINE 1:SELECT DISTINCT(Category) FROM "recalls"
^
:SELECT DISTINCT(Category) FROM "recalls"
ActiveRecord::StatementInvalid: PGError: ERROR: column "category" does not exist
LINE 1:SELECT DISTINCT(Category) FROM "recalls"
:SELECT DISTINCT(Category) FROM "recalls"
请表明是越来越运行SQL的全文。你可以从你的Rails日志中获得它。 –