]> source.dussan.org Git - redmine.git/commitdiff
shorten long line of app/models/setting.rb
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 5 Oct 2020 15:47:26 +0000 (15:47 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 5 Oct 2020 15:47:26 +0000 (15:47 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@20123 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/setting.rb

index e71a9a0cfb3d53462668b6264e941af474a03d79..64c2b8b4973fad8f45d1a4d2c7bdfbff99c3d3fd 100644 (file)
@@ -85,11 +85,19 @@ class Setting < ActiveRecord::Base
   cattr_accessor :available_settings
   self.available_settings ||= {}
 
-  validates_uniqueness_of :name, :if => Proc.new {|setting| setting.new_record? || setting.name_changed?}
+  validates_uniqueness_of(
+    :name,
+    :if => Proc.new do |setting|
+      setting.new_record? || setting.name_changed?
+    end
+  )
   validates_inclusion_of :name, :in => Proc.new {available_settings.keys}
-  validates_numericality_of :value, :only_integer => true, :if => Proc.new { |setting|
-    (s = available_settings[setting.name]) && s['format'] == 'int'
-  }
+  validates_numericality_of(
+    :value, :only_integer => true,
+    :if => Proc.new do |setting|
+      (s = available_settings[setting.name]) && s['format'] == 'int'
+    end
+  )
 
   # Hash used to cache setting values
   @cached_settings = {}