app/models/article.rb
# destroy all schedule articles in banner

destroy all schedule articles in banner
destroy all schedule articles in banner
def destroy_banner_schedules
    banner_run_id = self.banner_run_id.blank? and return 
    b_articles = self.class.find :all, :scope => :self,
                    :conditions => "banner_run_id = #{banner_run_id} AND id <> #{self.id}"
    b_articles.blank? and return 
    transaction do
      b_articles.each(&:destroy_run!)
    end
  end
def destroy_banner_schedules banner_run_id = self . banner_run_id . blank? and return b_articles = self . class . find :all , :scope => :self , :conditions => "banner_run_id = #{banner_run_id} AND id <> #{self.id}" b_articles . blank? and return transaction do b_articles . each ( & :destroy_run! ) end end
destroy all schedule articles in banner
destroy all schedule articles in banner
# do nothing
