From 00b1a40345493703bd48ce71f43e9bf4ec9e2950 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Thu, 5 Jun 2014 15:45:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E7=AB=9E=E8=B5=9B?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=8F=8A=E8=AF=84=E8=AE=BA=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/contestnotifications_controller.rb | 14 +++++++------- app/models/contestnotification.rb | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/controllers/contestnotifications_controller.rb b/app/controllers/contestnotifications_controller.rb index 8aea1a6cd..6a1ff23dd 100644 --- a/app/controllers/contestnotifications_controller.rb +++ b/app/controllers/contestnotifications_controller.rb @@ -65,7 +65,7 @@ class ContestnotificationsController < ApplicationController # GET /contestnotifications/1 # GET /contestnotifications/1.json def show - # @contestnotification = Contestnotification.find(params[:id]) + @contestnotification = Contestnotification.find(params[:id]) # # respond_to do |format| # format.html # show.html.erb @@ -136,12 +136,12 @@ class ContestnotificationsController < ApplicationController # format.json { render json: @contestnotification.errors, status: :unprocessable_entity } # end # end - @contestnotifications.safe_attributes = params[:contestnotifications] - @contestnotifications.save_attachments(params[:attachments]) - if @contestnotifications.save - render_attachment_warning_if_needed(@contestnotifications) + @contestnotification.safe_attributes = params[:contestnotification] + @contestnotification.save_attachments(params[:attachments]) + if @contestnotification.save + render_attachment_warning_if_needed(@contestnotification) flash[:notice] = l(:notice_successful_update) - redirect_to contestnotification_path(@contestnotifications) + redirect_to contest_contestnotification_path(@contestnotification) else render :action => 'edit' end @@ -158,7 +158,7 @@ class ContestnotificationsController < ApplicationController # format.json { head :no_content } # end @contestnotifications.destroy - redirect_to contest_contestnotification_index_path(@contest) + redirect_to contest_contestnotifications_path(@contest) end private diff --git a/app/models/contestnotification.rb b/app/models/contestnotification.rb index 2f09e7f9c..f245e7adc 100644 --- a/app/models/contestnotification.rb +++ b/app/models/contestnotification.rb @@ -41,18 +41,18 @@ class Contestnotification < ActiveRecord::Base end def recipients - contest.users.select {|user| user.notify_about?(self)}.map(&:mail) + #contest.users.select {|user| user.notify_about?(self)}.map(&:mail) end # returns latest news for contests visible by user def self.latest(user = User.current, count = 5) - visible(user).includes([:author, :contest]).order("#{Contestnotifications.table_name}.created_at DESC").limit(count).all + visible(user).includes([:author, :contest]).order("#{Contestnotification.table_name}.created_at DESC").limit(count).all end private def add_author_as_watcher - Watcher.create(:watchable => self, :user => author) + #Watcher.create(:watchable => self, :user => author) end ## fq def act_as_activity