jeudi 12 mai 2016

ActiveRecord::Migration unitialized constant error.

Disclaimer: I don't know ruby.

I've been trying to setup this ruby application. I'm trying to debug why I get an uninitialized constant error:

rake aborted!
StandardError: An error has occurred, all later migrations canceled:

uninitialized constant CreateSyncsTable::Syncs/var/rails/cycs/cycs/db/migrate/20100818122117_create_syncs_table.rb:8:in `up'

Below is the file contents of 20100818122117_create_syncs_table.rb.

class CreateSyncsTable < ActiveRecord::Migration
  def self.up
    create_table :syncs do |t|
      t.timestamps
      t.integer :remedy_query_low
      t.integer :remedy_query_high
    end
    Sync.create :remedy_query_low => 0, :remedy_query_high => 0
  end

  def self.down
    drop_table :syncs
  end
end

To my understanding, line 8 is trying to create a new entry into the syncs table. I don't know exactly why the syntax for doing so is as follows:

 Sync.create :remedy_query_low => 0, :remedy_query_high => 0

Nor do I understand why or where "Sync" comes from. Moreover, I don't know what constant is uninitialized.

Any help to debug this is appreciated. For the record, I am using centOS 7, Maria DB and ActiveRecord version 3.2.18.

  1. I reviewed the API to see if that would help. Since I don't know ruby, I don't find it of much help.

Aucun commentaire:

Enregistrer un commentaire