summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2023-11-27 20:58:55 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2023-11-27 20:58:55 +0000
commit7b911245d31509da8fa656bbedc37213d3148897 (patch)
treee3c7dd7cb0bd2438a895474056cfadbb4ac3262a /app/models
parent859bc07edb1f74ab348ff3c54b9af48e714575a2 (diff)
downloadredmine-7b911245d31509da8fa656bbedc37213d3148897.tar.gz
redmine-7b911245d31509da8fa656bbedc37213d3148897.zip
Updates Rails to 7.1.2 (#36320).
Patch by Takashi Kato. git-svn-id: https://svn.redmine.org/redmine/trunk@22488 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/attachment.rb10
-rw-r--r--app/models/query.rb8
-rw-r--r--app/models/role.rb2
3 files changed, 10 insertions, 10 deletions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 86382054d..97dea32bd 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -345,14 +345,14 @@ class Attachment < ActiveRecord::Base
# })
#
def self.update_attachments(attachments, params)
- params = params.transform_keys {|key| key.to_i}
-
+ converted = {}
+ params.each {|key, val| converted[key.to_i] = val}
saved = true
transaction do
attachments.each do |attachment|
- if p = params[attachment.id]
- attachment.filename = p[:filename] if p.key?(:filename)
- attachment.description = p[:description] if p.key?(:description)
+ if file = converted[attachment.id]
+ attachment.filename = file[:filename] if file.key?(:filename)
+ attachment.description = file[:description] if file.key?(:description)
saved &&= attachment.save
end
end
diff --git a/app/models/query.rb b/app/models/query.rb
index 5630f95c7..3208dc535 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -257,8 +257,8 @@ class Query < ActiveRecord::Base
has_and_belongs_to_many :roles, :join_table => "#{table_name_prefix}queries_roles#{table_name_suffix}", :foreign_key => "query_id"
serialize :filters
serialize :column_names
- serialize :sort_criteria, Array
- serialize :options, Hash
+ serialize :sort_criteria, type: Array
+ serialize :options, type: Hash
validates_presence_of :name
validates_length_of :name, :maximum => 255
@@ -1631,7 +1631,7 @@ class Query < ActiveRecord::Base
else
from = from - 1 # second
end
- if self.class.default_timezone == :utc
+ if ActiveRecord.default_timezone == :utc
from = from.utc
end
s << ("#{table}.#{field} > '%s'" % [quoted_time(from, is_custom_filter)])
@@ -1640,7 +1640,7 @@ class Query < ActiveRecord::Base
if to.is_a?(Date)
to = date_for_user_time_zone(to.year, to.month, to.day).end_of_day
end
- if self.class.default_timezone == :utc
+ if ActiveRecord.default_timezone == :utc
to = to.utc
end
s << ("#{table}.#{field} <= '%s'" % [quoted_time(to, is_custom_filter)])
diff --git a/app/models/role.rb b/app/models/role.rb
index 078419c60..1665d7982 100644
--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -76,7 +76,7 @@ class Role < ActiveRecord::Base
has_many :members, :through => :member_roles
acts_as_positioned :scope => :builtin
- serialize :permissions, ::Role::PermissionsAttributeCoder
+ serialize :permissions, coder: ::Role::PermissionsAttributeCoder
store :settings, :accessors => [:permissions_all_trackers, :permissions_tracker_ids]
validates_presence_of :name