From 2d1866d966d94c688f9cb87c5bf3f096dffac844 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 22 Oct 2014 17:37:16 +0000 Subject: Merged rails-4.1 branch (#14534). git-svn-id: http://svn.redmine.org/redmine/trunk@13482 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/version.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'app/models/version.rb') diff --git a/app/models/version.rb b/app/models/version.rb index 1d06360ef..45c7c25a6 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -33,11 +33,14 @@ class Version < ActiveRecord::Base validates :effective_date, :date => true validates_inclusion_of :status, :in => VERSION_STATUSES validates_inclusion_of :sharing, :in => VERSION_SHARINGS + attr_protected :id scope :named, lambda {|arg| where("LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip)} scope :open, lambda { where(:status => 'open') } scope :visible, lambda {|*args| - includes(:project).where(Project.allowed_to_condition(args.first || User.current, :view_issues)) + joins(:project). + references(:project). + where(Project.allowed_to_condition(args.first || User.current, :view_issues)) } safe_attributes 'name', @@ -230,11 +233,6 @@ class Version < ActiveRecord::Base end end - # Returns true if the version is shared, otherwise false - def shared? - sharing != 'none' - end - private def load_issue_counts -- cgit v1.2.3