3

I'm complete noob at PostgreSQL, Ruby on Rails..

I'm trying to follow this tutorial (WITHOUT rubymine) http://www.codeproject.com/Articles/575551/User-Authentication-in-Ruby-on-Rails#InstallingRubyMine4

I have as such this to migrate (001_create_user_model.rb):

class CreateUserModel < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
      t.column :username, :string
      t.column :email, :string
      t.column :password_hash, :string
      t.column :password_salt, :string
    end
  end

  def self.down
    drop_table :users
  end
end

The error I'm getting goes like this:

syntax error, unexpected ':', expecting ';' or '\n'
        t.column...sers do |t|

...
C:131071:in 'disable_dll_transaction'
Task:TOP => db:migrate
mu is too short
  • 426,620
  • 70
  • 833
  • 800
Ahmad Bilal
  • 380
  • 1
  • 2
  • 15

1 Answers1

1

What about this:

class CreateUserModel < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
      t.string :username, :null => false
      t.string :email,:null => false
      t.string :password_hash, :null => false
      t.string :password_salt, :null => false
      t.timestamps
    end
  end

  def self.down
    drop_table :users
  end
end
Benjamin Tan Wei Hao
  • 9,621
  • 3
  • 30
  • 56
  • Besides the textual differences? I just picked out a random migration and converted it to that format. Not sure if Ahmad's migration is from an older version of Rails. – Benjamin Tan Wei Hao Sep 04 '13 at 04:36
  • Not textual difference. His code is still valid according to ActiveRecord::Migration documentation. Your answer should be 'You can also use the column types as method calls, rather than calling the column method.' But it not solving the problem from code view. – hawk Sep 04 '13 at 04:51
  • Worth a shot, FWIW. Besides, we don't have much to go on. :) – Benjamin Tan Wei Hao Sep 04 '13 at 04:54