Skip to content

Commit

Permalink
move setting of order to comment model. makes it easier to remove/change
Browse files Browse the repository at this point in the history
  • Loading branch information
jackdempsey committed Jul 29, 2009
1 parent 55edcad commit 5300da4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion generators/comment/templates/comment.rb
Expand Up @@ -4,11 +4,13 @@ class Comment < ActiveRecord::Base

belongs_to :commentable, :polymorphic => true

default_scope :order => 'created_at ASC'

# NOTE: install the acts_as_votable plugin if you
# want user to vote on the quality of comments.
#acts_as_voteable

# NOTE: Comments belong to a user
belongs_to :user

end
end
4 changes: 2 additions & 2 deletions lib/commentable_methods.rb
Expand Up @@ -11,7 +11,7 @@ def self.included(base)

module ClassMethods
def acts_as_commentable
has_many :comments, :as => :commentable, :dependent => :destroy, :order => 'created_at ASC'
has_many :comments, :as => :commentable, :dependent => :destroy
include Juixe::Acts::Commentable::InstanceMethods
extend Juixe::Acts::Commentable::SingletonMethods
end
Expand Down Expand Up @@ -63,4 +63,4 @@ def add_comment(comment)
end
end

ActiveRecord::Base.send(:include, Juixe::Acts::Commentable)
ActiveRecord::Base.send(:include, Juixe::Acts::Commentable)

0 comments on commit 5300da4

Please sign in to comment.