rake db:migrate RAILS_ENV=test
1.App/modles/test_paper.rb
class TestPaper < ActiveRecord::Base
attr_accessible :course_id, :user_id
belongs_to :course
belongs_to :user
has_many :test_paper_test_questions
has_many :test_questions, :through => :test_paper_test_questions
validates :course_id, :presence => true
validates :user_id, :presence => true
def self.make_test_paper_for(course,user)
paper = self.create(:course_id => course.id,:user_id => use......
阅读全文