Test Test
Test Test

Reputation: 2899

MySQL and rails syntax error

I configured rails to work fine with Rails 3. I am trying to create a migration, and here it is its code:

class CreateObservations < ActiveRecord::Migration
  def change
    create_table :observations do |t|
      t.integer :user_id
      t.integer :start
      t.integer :end
      t.string :videoID
      t.string :event
      t.string :content

      t.timestamps
    end
    add_index :observations, [:user_id, :created_at]

  end
end

now when I run 'rake db:migrate' I get this strange error: why?

demo_app/test/factories/observations.rb:7:syntax error, unexpected tINTEGER, expecting keyword_end
demo_app/test/factories/observations.rb:12: syntax error, unexpected keyword_end, expecting $end

Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

I am NOT doing any testing now. Just development. so I run this:

 rake db:migrate RAILS_ENV=development

and I get the same error.

here is the code in the factory girl which I dont want to include!!!

FactoryGirl.define do
  factory :observation do
    user_id 1
    start 1
    end 1
    videoID "MyString"
    event "MyString"
    content "MyString"
  end
end

Upvotes: 0

Views: 238

Answers (1)

Said Kaldybaev
Said Kaldybaev

Reputation: 10002

It's probably because of using end field try to change it to something different

Upvotes: 1

Related Questions