summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/note.rb2
-rw-r--r--app/models/project.rb4
-rw-r--r--app/models/wiki.rb1
3 files changed, 5 insertions, 2 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 4c46c7dfffa..34edb94edca 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -36,7 +36,7 @@ class Note < ActiveRecord::Base
scope :today, where("created_at >= :date", date: Date.today)
scope :last_week, where("created_at >= :date", date: (Date.today - 7.days))
scope :since, lambda { |day| where("created_at >= :date", date: (day)) }
- scope :fresh, order("created_at DESC")
+ scope :fresh, order("created_at ASC, id ASC")
scope :inc_author_project, includes(:project, :author)
scope :inc_author, includes(:author)
diff --git a/app/models/project.rb b/app/models/project.rb
index 4de836c7b48..56d5d7910b9 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -171,6 +171,10 @@ class Project < ActiveRecord::Base
end
end
+ def wiki_notes
+ Note.where(noteable_id: wikis.map(&:id), noteable_type: 'Wiki', project_id: self.id)
+ end
+
def project_id
self.id
end
diff --git a/app/models/wiki.rb b/app/models/wiki.rb
index 3c4952cd291..ebb1ff49c7a 100644
--- a/app/models/wiki.rb
+++ b/app/models/wiki.rb
@@ -28,7 +28,6 @@ class Wiki < ActiveRecord::Base
end
new_wiki
end
-
end
end
# == Schema Information