summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-11-12 12:31:20 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-11-12 12:31:20 +0000
commit4ce729d5af9c21a15e774ab74bcf287592cd9c3f (patch)
tree2f17332b787eaf905d9daf4d7df1b1058e5f870a
parent0ba5cd4feadf831ec4306c586fbb851554002992 (diff)
downloadredmine-4ce729d5af9c21a15e774ab74bcf287592cd9c3f.tar.gz
redmine-4ce729d5af9c21a15e774ab74bcf287592cd9c3f.zip
use "do end" instead of {} at ActiveRecord scope lambda of app/models/issue.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@20342 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/issue.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 18412d5f6..49e699720 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -72,39 +72,39 @@ class Issue < ActiveRecord::Base
validates :due_date, :date => true
validate :validate_issue, :validate_required_fields, :validate_permissions
- scope :visible, lambda {|*args|
+ scope :visible, (lambda do |*args|
joins(:project).
where(Issue.visible_condition(args.shift || User.current, *args))
- }
+ end)
- scope :open, lambda {|*args|
+ scope :open, (lambda do |*args|
is_closed = !args.empty? ? !args.first : false
joins(:status).
where(:issue_statuses => {:is_closed => is_closed})
- }
+ end)
scope :recently_updated, lambda {order(:updated_on => :desc)}
- scope :on_active_project, lambda {
+ scope :on_active_project, (lambda do
joins(:project).
where(:projects => {:status => Project::STATUS_ACTIVE})
- }
- scope :fixed_version, lambda {|versions|
+ end)
+ scope :fixed_version, (lambda do |versions|
ids = [versions].flatten.compact.map {|v| v.is_a?(Version) ? v.id : v}
ids.any? ? where(:fixed_version_id => ids) : none
- }
- scope :assigned_to, lambda {|arg|
+ end)
+ scope :assigned_to, (lambda do |arg|
arg = Array(arg).uniq
ids = arg.map {|p| p.is_a?(Principal) ? p.id : p}
ids += arg.select {|p| p.is_a?(User)}.map(&:group_ids).flatten.uniq
ids.compact!
ids.any? ? where(:assigned_to_id => ids) : none
- }
- scope :like, lambda {|q|
+ end)
+ scope :like, (lambda do |q|
q = q.to_s
if q.present?
where("LOWER(#{table_name}.subject) LIKE LOWER(?)", "%#{q}%")
end
- }
+ end)
before_validation :default_assign, on: :create
before_validation :clear_disabled_fields