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
belongs_to :user
belongs_to :language, :foreign_key => 'language_code'
- has_many :diary_comments, :include => :user,
- :conditions => {
- :users => { :visible => true },
- :visible => true
- },
- :order => "diary_comments.id"
+ 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
+ },
+ :order => "diary_comments.id"
validates_presence_of :title, :body
validates_length_of :title, :within => 1..255
|
<%= 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 %>
<a id="comments"></a>
-<%= render :partial => 'diary_comment', :collection => @entry.diary_comments %>
+<%= render :partial => 'diary_comment', :collection => @entry.visible_comments %>
<% if @user %>