2

I started getting an error in the schema.rb file when i ran this migration below. I was following a tutorial for UUID (tutorial) and I'm not sure if this was right. I have it working fine but i cant see the table in the schema.rb file and i cant run rake db:rollback.

 class AddUuidToUsers < ActiveRecord::Migration
  def up
   add_column :users, :uuid, :uuid
  end

 def down
   remove_column :users, :uuid
 end
end

This is the error when i run rake db:rollback

undefined method `to_sym' for    nil:NilClass/Applications/MAMP/htdocs/Sites/ubergradd/db/migrate/20141024175231_add_uuid_to_users.rb:7:in `down'
NoMethodError: undefined method `to_sym' for nil:NilClass
/Applications/MAMP/htdocs/Sites/ubergradd/db/migrate/20141024175231_add_uuid_to_users.rb:7:in `down'

In my schema.rb file

 # Could not dump table "users" because of following NoMethodError
 #   undefined method `[]' for nil:NilClass
Wesly
  • 343
  • 2
  • 12
  • Please add information when you get error mentioned in title and what tutorial you've been following. What happens when you run ````rake db:rollback````? – Esse Oct 24 '14 at 20:39
  • I added more information to the question. – Wesly Oct 24 '14 at 20:52
  • And you're using postgres with added extensions? Which Rails 4 version? When you look into database (using psql command for example) do you see this column in users table? – Esse Oct 24 '14 at 20:55
  • Im using Rails 4.1.4. When i look into the database using the command i can see the column in the users table. – Wesly Oct 24 '14 at 21:22
  • It seems very similar to this error: http://stackoverflow.com/questions/17893326/rails-4-schema-db-shows-could-not-dump-table-events-because-of-following-nom Are you **100** percent sure, that you've enabled uuid-ossp extenstion on your local postgres instantion? – Esse Oct 24 '14 at 21:45

0 Answers0