Make diary comment creation work again.

This commit is contained in:
Tom Hughes 2009-11-15 11:00:54 +00:00
parent ea294c5a68
commit 57a05a40fc
4 changed files with 13 additions and 9 deletions

View file

@ -52,7 +52,7 @@ class DiaryEntryController < ApplicationController
def comment
@entry = DiaryEntry.find(params[:id])
@diary_comment = @entry.diary_comments.build(params[:diary_comment])
@diary_comment = @entry.comments.build(params[:diary_comment])
@diary_comment.user = @user
if @diary_comment.save
if @diary_comment.user != @entry.user

View file

@ -2,7 +2,11 @@ class DiaryEntry < ActiveRecord::Base
belongs_to :user
belongs_to :language, :foreign_key => 'language_code'
has_many :diary_comments, :include => :user,
has_many :comments, :class_name => "DiaryComment",
:include => :user,
:order => "diary_comments.id"
has_many :visible_comments, :class_name => "DiaryComment",
:include => :user,
:conditions => {
:users => { :visible => true },
:visible => true

View file

@ -10,7 +10,7 @@
|
<%= link_to t('diary_entry.diary_entry.reply_link'), :controller => 'message', :action => 'new', :display_name => diary_entry.user.display_name, :title => "Re: #{diary_entry.title}" %>
|
<%= link_to t('diary_entry.diary_entry.comment_count', :count => diary_entry.diary_comments.count), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'comments' %>
<%= link_to t('diary_entry.diary_entry.comment_count', :count => diary_entry.visible_comments.count), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'comments' %>
<% end %>
<% if @user == diary_entry.user %>
| <%= link_to t('diary_entry.diary_entry.edit_link'), :action => 'edit', :display_name => @user.display_name, :id => diary_entry.id %>

View file

@ -4,7 +4,7 @@
<a id="comments"></a>
<%= render :partial => 'diary_comment', :collection => @entry.diary_comments %>
<%= render :partial => 'diary_comment', :collection => @entry.visible_comments %>
<% if @user %>