diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/changeset.rb | 2 | ||||
-rw-r--r-- | app/models/document.rb | 2 | ||||
-rw-r--r-- | app/models/issue.rb | 2 | ||||
-rw-r--r-- | app/models/journal.rb | 2 | ||||
-rw-r--r-- | app/models/message.rb | 4 | ||||
-rw-r--r-- | app/models/news.rb | 2 | ||||
-rw-r--r-- | app/models/project.rb | 6 | ||||
-rw-r--r-- | app/models/wiki_page.rb | 2 |
8 files changed, 13 insertions, 9 deletions
diff --git a/app/models/changeset.rb b/app/models/changeset.rb index 3e95ce111..9a05e6a68 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -27,7 +27,7 @@ class Changeset < ActiveRecord::Base :url => Proc.new {|o| {:controller => 'repositories', :action => 'revision', :id => o.repository.project_id, :rev => o.revision}} acts_as_searchable :columns => 'comments', - :include => :repository, + :include => {:repository => :project}, :project_key => "#{Repository.table_name}.project_id", :date_column => 'committed_on' diff --git a/app/models/document.rb b/app/models/document.rb index 7a432b46b..9e2818fc7 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -20,7 +20,7 @@ class Document < ActiveRecord::Base belongs_to :category, :class_name => "Enumeration", :foreign_key => "category_id" has_many :attachments, :as => :container, :dependent => :destroy - acts_as_searchable :columns => ['title', 'description'] + acts_as_searchable :columns => ['title', "#{table_name}.description"], :include => :project acts_as_event :title => Proc.new {|o| "#{l(:label_document)}: #{o.title}"}, :author => Proc.new {|o| (a = o.attachments.find(:first, :order => "#{Attachment.table_name}.created_on ASC")) ? a.author : nil }, :url => Proc.new {|o| {:controller => 'documents', :action => 'show', :id => o.id}} diff --git a/app/models/issue.rb b/app/models/issue.rb index 8082e43b7..0618b0f0a 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -36,7 +36,7 @@ class Issue < ActiveRecord::Base has_many :relations_to, :class_name => 'IssueRelation', :foreign_key => 'issue_to_id', :dependent => :delete_all acts_as_watchable - acts_as_searchable :columns => ['subject', 'description'], :with => {:journal => :issue} + acts_as_searchable :columns => ['subject', "#{table_name}.description"], :include => :project, :with => {:journal => :issue} acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id}: #{o.subject}"}, :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}} diff --git a/app/models/journal.rb b/app/models/journal.rb index 1376d349e..edf261e6d 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -26,7 +26,7 @@ class Journal < ActiveRecord::Base attr_accessor :indice acts_as_searchable :columns => 'notes', - :include => :issue, + :include => {:issue => :project}, :project_key => "#{Issue.table_name}.project_id", :date_column => "#{Issue.table_name}.created_on" diff --git a/app/models/message.rb b/app/models/message.rb index a18d126c9..f57b90985 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -23,9 +23,9 @@ class Message < ActiveRecord::Base belongs_to :last_reply, :class_name => 'Message', :foreign_key => 'last_reply_id' acts_as_searchable :columns => ['subject', 'content'], - :include => :board, + :include => {:board, :project}, :project_key => 'project_id', - :date_column => 'created_on' + :date_column => "#{table_name}.created_on" acts_as_event :title => Proc.new {|o| "#{o.board.name}: #{o.subject}"}, :description => :content, :type => Proc.new {|o| o.parent_id.nil? ? 'message' : 'reply'}, diff --git a/app/models/news.rb b/app/models/news.rb index 3d8c4d661..71e2a2d5e 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -24,7 +24,7 @@ class News < ActiveRecord::Base validates_length_of :title, :maximum => 60 validates_length_of :summary, :maximum => 255 - acts_as_searchable :columns => ['title', 'description'] + acts_as_searchable :columns => ['title', "#{table_name}.description"], :include => :project acts_as_event :url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.id}} # returns latest news for projects visible by user diff --git a/app/models/project.rb b/app/models/project.rb index 8c32c8562..2f2937fd9 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -46,7 +46,7 @@ class Project < ActiveRecord::Base acts_as_tree :order => "name", :counter_cache => true - acts_as_searchable :columns => ['name', 'description'], :project_key => 'id' + acts_as_searchable :columns => ['name', 'description'], :project_key => 'id', :permission => nil acts_as_event :title => Proc.new {|o| "#{l(:label_project)}: #{o.name}"}, :url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o.id}} @@ -202,6 +202,10 @@ class Project < ActiveRecord::Base @all_custom_fields ||= (IssueCustomField.for_all + custom_fields).uniq end + def project + self + end + def <=>(project) name.downcase <=> project.name.downcase end diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 95750f37b..65fc1f68c 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -29,7 +29,7 @@ class WikiPage < ActiveRecord::Base :url => Proc.new {|o| {:controller => 'wiki', :id => o.wiki.project_id, :page => o.title}} acts_as_searchable :columns => ['title', 'text'], - :include => [:wiki, :content], + :include => [{:wiki => :project}, :content], :project_key => "#{Wiki.table_name}.project_id" attr_accessor :redirect_existing_links |