diff --git a/app/models/contestnotification.rb b/app/models/contestnotification.rb index cba9dfa0c..04ceb93c2 100644 --- a/app/models/contestnotification.rb +++ b/app/models/contestnotification.rb @@ -1,10 +1,10 @@ class Contestnotification < ActiveRecord::Base - attr_accessible :author_id, :comments_count, :contest_id, :description, :summary, :title + attr_accessible :author_id, :notificationcomments_count, :contest_id, :description, :summary, :title include Redmine::SafeAttributes belongs_to :contest belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' - has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_at" + has_many :notificationcomments, :as => :notificationcommented, :dependent => :delete_all, :order => "created_at" # fq has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy diff --git a/app/models/notificationcomments.rb b/app/models/notificationcomments.rb index 142cef1db..1aad7c7e3 100644 --- a/app/models/notificationcomments.rb +++ b/app/models/notificationcomments.rb @@ -5,7 +5,7 @@ class Notificationcomments < ActiveRecord::Base belongs_to :notificationcommented, :polymorphic => true, :counter_cache => true belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' - validates_presence_of :notificationcommented, :author, :comments + validates_presence_of :notificationcommented, :author, :notificationcomments safe_attributes 'notificationcomments' end diff --git a/app/views/contestnotifications/show.html.erb b/app/views/contestnotifications/show.html.erb index a9ba5f513..bd4c8a4f8 100644 --- a/app/views/contestnotifications/show.html.erb +++ b/app/views/contestnotifications/show.html.erb @@ -70,12 +70,12 @@ <% if @contestnotifications.notificationcommentable? %>
- <%= toggle_link l(:label_comment_add), "add_notificationcomment_form", :focus => "comment_comments" %> + <%= toggle_link l(:label_comment_add), "add_notificationcomment_form", :focus => "notificationcomment_notificationcomments" %>
<%= form_tag({:controller => 'notificationcomments', :action => 'create', :id => @contestnotifications}, :id => "add_notificationcomment_form", :style => "display:none;") do %><%= submit_tag l(:button_add) %>