0

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
1
  • What's in demo_app/test/factories/observations.rb? Commented Mar 25, 2012 at 15:29

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

8 Comments

omg, I just noticed that. is there a way to change that without re creating the whole model?!? or changing loads of files?
@TestTest You could avoid it by carefully programming around it but it will generally be a pain in the ass. Better suck it up and change your model.
rake db:drop && rake db:create && rake db:migrate should work
yeah but I still need to delete my model right? (the views etc etc)
no, no need to delete your model, first rake db:drop, then delete end from migration then rake db:create && rake db:migrate
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.