实训报错

dev_bj
daiao 6 years ago
parent 63f9a3cac1
commit 71300897a5

@ -53,7 +53,6 @@ class Shixun < ActiveRecord::Base
has_many :tag_repertoires, :through => :shixun_tag_repertoires
has_many :shixun_tag_repertoires, :dependent => :destroy
has_many :shixun_service_configs, :dependent => :destroy
has_one :shixun_info, :dependent => :destroy
scope :visible, lambda{where(status: [2,3])}
scope :min, lambda { select([:id, :name, :gpid, :modify_time, :reset_time, :language, :status, :identifier,
@ -67,18 +66,6 @@ class Shixun < ActiveRecord::Base
#scope :visible, -> { where(status: -1) }
after_create :send_tiding
def description
self.has_attribute?(:description) ? self[:description] : ""
end
def propaedeutics
self.has_attribute?(:propaedeutics) ? self[:propaedeutics] : ""
end
def evaluate_script
self.has_attribute?(:evaluate_script) ? self[:evaluate_script] : ""
end
def should_compile?
self.mirror_repositories.published_main_mirror.first.try(:should_compile)
end

@ -1,4 +0,0 @@
class ShixunInfo < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :shixun
end

@ -1,17 +0,0 @@
class AddEvaluateScriptAndDescriptionForShixuns < ActiveRecord::Migration
def up
add_column :shixuns, :evaluate_script, :text
add_column :shixuns, :description, :text
add_column :shixuns, :propaedeutics, :text
shixuns = Shixun.where(nil).unscoped
shixuns.find_each do |shixun|
shixun.update_attributes(evaluate_script: shixun.shixun_info.try(:evaluate_script),
description: shixun.shixun_info.try(:description),
propaedeutics: shixun.shixun_info.try(:description))
end
end
def down
end
end
Loading…
Cancel
Save