diff app/models/.svn/text-base/document.rb.svn-base @ 246:eeebe205a056 cannam

* Merge from default branch, bringing us up to SVN trunk rev 4993
author Chris Cannam
date Thu, 03 Mar 2011 12:02:03 +0000
parents 0579821a129a
children cbce1fd3b1b7
line wrap: on
line diff
--- a/app/models/.svn/text-base/document.rb.svn-base	Thu Jan 20 09:59:02 2011 +0000
+++ b/app/models/.svn/text-base/document.rb.svn-base	Thu Mar 03 12:02:03 2011 +0000
@@ -29,6 +29,9 @@
   validates_presence_of :project, :title, :category
   validates_length_of :title, :maximum => 60
   
+  named_scope :visible, lambda {|*args| { :include => :project,
+                                          :conditions => Project.allowed_to_condition(args.first || User.current, :view_documents) } }
+  
   def visible?(user=User.current)
     !user.nil? && user.allowed_to?(:view_documents, project)
   end