diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index cf40a5c07..882bc19e5 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -167,8 +167,8 @@ class ShixunsController < ApplicationController logger.info("###################{res['code']}") if res && res['code'].to_i == 0 logger.info("1111###################{res['code']}") - @shixun.update_attributes(:status => 1, :is_updated => 1) - apply = ApplyAction.where(:container_type => "ApplyShixun", :container_id => @shixun.id).last + @shixun.update_attributes(:status => 1) + apply = ApplyAction.where(:container_type => "ApplyShixun", :container_id => @shixun.id).order("created_at desc").first if apply && apply.status == 0 @status = 0 else diff --git a/app/models/shixun.rb b/app/models/shixun.rb index 69beab432..af9cbe5da 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -7,7 +7,7 @@ # class Shixun < ActiveRecord::Base attr_accessible :description, :is_public, :name, :changeset_num, :status, :user_id, :gpid, :language, :identifier, :authentication, - :myshixun_count, :propaedeutics, :is_updated + :myshixun_count, :propaedeutics has_many :users, :through => :shixun_members has_many :shixun_members, :dependent => :destroy