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