Rails create_table query

Posted by Steve on Stack Overflow See other posts from Stack Overflow or by Steve
Published on 2010-04-27T20:30:57Z Indexed on 2010/04/27 20:33 UTC
Read the original article Hit count: 179

Filed under:
|

Hi, I am a beginner in Rails. In the following code,there is an id which is set as false. What's the meaning of it?

class CreateCoursesStudents < ActiveRecord::Migration 
  def self.up
    create_table :courses_students, :id => false do |t| t.integer :course_id,  
    :null => false t.integer :student_id, :null => false
  end
  # Add index to speed up looking up the connection, and ensure # we only enrol  
  a student into each course once 
    add_index :courses_students, [:course_id, :student_id], :unique => true
  end

  def self.down
    remove_index :courses_students, :column => [:course_id, :student_id]
    drop_table :courses_students 
  end
end

Thanks

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby