diff --git a/app/models/comment.rb b/app/models/comment.rb index 71cfae25f..16edcf412 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -32,6 +32,8 @@ class Comment < ActiveRecord::Base serialize :youtube_titles, Hash + scope :including_author, includes(:author => :profile) + before_save do self.text.strip! unless self.text.nil? end diff --git a/app/views/comments/_comments.html.haml b/app/views/comments/_comments.html.haml index f8cfa7e30..5f7d79c45 100644 --- a/app/views/comments/_comments.html.haml +++ b/app/views/comments/_comments.html.haml @@ -9,9 +9,9 @@ %ul.comments{:class => ('loaded' if post.comments.size <= 3)} -if post.comments.size > 3 && !comments_expanded && ! all_comments? - = render :partial => 'comments/comment', :collection => post.comments.last(3), :locals => {:post => post} + = render :partial => 'comments/comment', :collection => post.comments.last(3).including_author, :locals => {:post => post} -else - = render :partial => 'comments/comment', :collection => post.comments, :locals => {:post => post} + = render :partial => 'comments/comment', :collection => post.comments.including_author, :locals => {:post => post} - unless commenting_disabled?(post) .new_comment_form_wrapper{:class => comment_form_wrapper_class(post)}