]> source.dussan.org Git - redmine.git/commitdiff
Code cleanup.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 13 Dec 2012 13:43:01 +0000 (13:43 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 13 Dec 2012 13:43:01 +0000 (13:43 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10994 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue_category.rb
app/models/message.rb
app/models/principal.rb

index 628f2686ff723f2eb0f13f0b04c608d4b9272dec..6f0577ea1d52a495e38308a85be18b48f88eb000 100644 (file)
@@ -35,7 +35,7 @@ class IssueCategory < ActiveRecord::Base
   # If a category is specified, issues are reassigned to this category
   def destroy(reassign_to = nil)
     if reassign_to && reassign_to.is_a?(IssueCategory) && reassign_to.project == self.project
-      Issue.update_all("category_id = #{reassign_to.id}", "category_id = #{id}")
+      Issue.update_all({:category_id => reassign_to.id}, {:category_id => id})
     end
     destroy_without_reassign
   end
index 53b461501e861bb4a85b9188a638d1e9d3583ba5..6dc9c54d2ff1ecb23b33c9845a6b5cde7f71c169 100644 (file)
@@ -67,7 +67,7 @@ class Message < ActiveRecord::Base
 
   def update_messages_board
     if board_id_changed?
-      Message.update_all("board_id = #{board_id}", ["id = ? OR parent_id = ?", root.id, root.id])
+      Message.update_all({:board_id => board_id}, ["id = ? OR parent_id = ?", root.id, root.id])
       Board.reset_counters!(board_id_was)
       Board.reset_counters!(board_id)
     end
index 72cae3719cada3ede88fffba5f52aae8b55314a5..f6a91a4716ca0521b5603d2abf569852f5e412e6 100644 (file)
@@ -30,7 +30,7 @@ class Principal < ActiveRecord::Base
   has_many :issue_categories, :foreign_key => 'assigned_to_id', :dependent => :nullify
 
   # Groups and active users
-  scope :active, lambda { where("#{Principal.table_name}.status = 1") }
+  scope :active, lambda { where(:status => STATUS_ACTIVE) }
 
   scope :like, lambda {|q|
     q = q.to_s
@@ -57,7 +57,7 @@ class Principal < ActiveRecord::Base
       where("1=0")
     else
       ids = projects.map(&:id)
-      where("#{Principal.table_name}.status = 1 AND #{Principal.table_name}.id IN (SELECT DISTINCT user_id FROM #{Member.table_name} WHERE project_id IN (?))", ids)
+      active.where("#{Principal.table_name}.id IN (SELECT DISTINCT user_id FROM #{Member.table_name} WHERE project_id IN (?))", ids)
     end
   }
   # Principals that are not members of projects