course add data

This commit is contained in:
xianbo 2013-09-06 16:40:07 +08:00
parent 1e7d127998
commit 7dbcc1520c
2 changed files with 29 additions and 0 deletions

15
app/models/course.rb Normal file
View File

@ -0,0 +1,15 @@
class Course < ActiveRecord::Base
include Redmine::SafeAttributes
attr_accessible :code, :extra, :name, :state, :tea_id, :time
belongs_to :project, :class_name => 'Project', :foreign_key => :tea_id
has_many :bid
validates_presence_of :code, :time
safe_attributes 'extra',
'time',
'name',
'extra',
'code'
end

View File

@ -0,0 +1,14 @@
class CreateCourses < ActiveRecord::Migration
def change
create_table :courses do |t|
t.integer :tea_id
t.string :name
t.integer :state
t.string :code
t.integer :time
t.string :extra
t.timestamps
end
end
end