@@ -64,7 +64,6 class Issue < ActiveRecord::Base | |||
|
64 | 64 | lambda {|*args| { :include => :project, |
|
65 | 65 | :conditions => Issue.visible_condition(args.shift || User.current, *args) } } |
|
66 | 66 | |
|
67 | class << self; undef :open; end | |
|
68 | 67 | scope :open, lambda {|*args| |
|
69 | 68 | is_closed = args.size > 0 ? !args.first : false |
|
70 | 69 | {:conditions => ["#{IssueStatus.table_name}.is_closed = ?", is_closed], :include => :status} |
@@ -35,7 +35,6 class Version < ActiveRecord::Base | |||
|
35 | 35 | validates_inclusion_of :sharing, :in => VERSION_SHARINGS |
|
36 | 36 | |
|
37 | 37 | scope :named, lambda {|arg| { :conditions => ["LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip]}} |
|
38 | class << self; undef :open; end | |
|
39 | 38 | scope :open, :conditions => {:status => 'open'} |
|
40 | 39 | scope :visible, lambda {|*args| { :include => :project, |
|
41 | 40 | :conditions => Project.allowed_to_condition(args.first || User.current, :view_issues) } } |
@@ -10,6 +10,11 module ActiveRecord | |||
|
10 | 10 | l("field_#{name.underscore.gsub('/', '_')}_#{attr}", :default => ["field_#{attr}".to_sym, attr]) |
|
11 | 11 | end |
|
12 | 12 | end |
|
13 | ||
|
14 | # Undefines private Kernel#open method to allow using `open` scopes in models. | |
|
15 | # See Defect #11545 (http://www.redmine.org/issues/11545) for details. | |
|
16 | class Base ; undef open ; end | |
|
17 | class Relation ; undef open ; end | |
|
13 | 18 | end |
|
14 | 19 | |
|
15 | 20 | module ActionView |
@@ -132,6 +132,10 class ProjectTest < ActiveSupport::TestCase | |||
|
132 | 132 | end |
|
133 | 133 | end |
|
134 | 134 | |
|
135 | def test_open_scope_on_issues_association | |
|
136 | assert_kind_of Issue, Project.find(1).issues.open.first | |
|
137 | end | |
|
138 | ||
|
135 | 139 | def test_archive |
|
136 | 140 | user = @ecookbook.members.first.user |
|
137 | 141 | @ecookbook.archive |
General Comments 0
You need to be logged in to leave comments.
Login now