回复测试版

dev_bj
daiao 6 years ago
parent a88becc482
commit 2510631db9

@ -53,6 +53,7 @@ class Shixun < ActiveRecord::Base
has_many :tag_repertoires, :through => :shixun_tag_repertoires has_many :tag_repertoires, :through => :shixun_tag_repertoires
has_many :shixun_tag_repertoires, :dependent => :destroy has_many :shixun_tag_repertoires, :dependent => :destroy
has_many :shixun_service_configs, :dependent => :destroy has_many :shixun_service_configs, :dependent => :destroy
has_one :shixun_info, :dependent => :destroy
scope :visible, lambda{where(status: [2,3])} scope :visible, lambda{where(status: [2,3])}
scope :min, lambda { select([:id, :name, :gpid, :modify_time, :reset_time, :language, :status, :identifier, scope :min, lambda { select([:id, :name, :gpid, :modify_time, :reset_time, :language, :status, :identifier,

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

@ -0,0 +1,17 @@
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

@ -0,0 +1,5 @@
FactoryGirl.define do
factory :shixun_info do
end
end

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe ShixunInfo, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save