Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Rails 4-postgresql 9.4 jsonb不存在_Postgresql_Ruby On Rails 4_Jsonb - Fatal编程技术网

Rails 4-postgresql 9.4 jsonb不存在

Rails 4-postgresql 9.4 jsonb不存在,postgresql,ruby-on-rails-4,jsonb,Postgresql,Ruby On Rails 4,Jsonb,我在我的项目中使用了rails 4和postgresql 9.4。当我运行“rdd&&rdc&&rdm&&rds”时,我遇到了这个错误PG::UnfinedObject:error:type“jsonb”不存在如何解决这个错误?告诉我 我的迁移文件: class CreateConsultingLocationDoctorSchedules < ActiveRecord::Migration def change create_table :consulting_loca

我在我的项目中使用了rails 4和postgresql 9.4。当我运行“rdd&&rdc&&rdm&&rds”时,我遇到了这个错误PG::UnfinedObject:error:type“jsonb”不存在如何解决这个错误?告诉我

我的迁移文件:

class CreateConsultingLocationDoctorSchedules < ActiveRecord::Migration
   def change
      create_table :consulting_location_doctor_schedules do |t|
           t.belongs_to :consulting_location_doctor
           t.datetime :schedule_date, null: false
           t.jsonb :slot_details, index: true, default: {}
           t.daterange :start_and_end_time, null: false
           t.datetime :deleted_at
           t.belongs_to :deleted_by

           t.timestamps
      end
   end
end
class CreateConsultingLocationDoctorSchedules

谢谢你的帮助

检查您是否连接到开发中的正确Postgres实例

rails console
ActiveRecord::Base.connection.execute("select version();").first["version"]
如果您确定自己正在运行9.4,那么可能有两台Postgres服务器正在运行。一个9.4,一个旧的


我遇到了这个问题,编辑了我的database.yml并指定了
host:'localhost'

,这将表明您的Rails版本实际上不是4.2,因为至少您的格式是正确的,并且必要的版本是Rails的4.2版本和PostgreSQL的9.4版本。你能仔细检查一下吗?我有同样的问题,我正在使用rails 4.2和第9.4.1页,你找到了解决方案吗?重复的问题和解决方案在这里:在我的情况下,正确的postgres在5433端口上运行。