Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

allow setting of virtual attributes

ulfertsdbf1d4cb4ec0
diff --git a/app/models/action.rb b/app/models/action.rb
index 2d5e121340e..903bacbe46f 100644
--- a/app/models/action.rb
+++ b/app/models/action.rb
@@ -34,8 +34,8 @@ class Action < ApplicationRecord
default_scope { default }
- define_attribute :id, ActiveRecord::Type.lookup(:text), default: nil
- define_attribute :permission, ActiveRecord::Type.lookup(:text), default: nil
- define_attribute :global, ActiveRecord::Type.lookup(:boolean), default: false
- define_attribute :module, ActiveRecord::Type.lookup(:text), default: false
+ attribute :id, ActiveRecord::Type.lookup(:text), default: nil
+ attribute :permission, ActiveRecord::Type.lookup(:text), default: nil
+ attribute :global, ActiveRecord::Type.lookup(:boolean), default: false
+ attribute :module, ActiveRecord::Type.lookup(:text), default: false
end
diff --git a/app/models/capability.rb b/app/models/capability.rb
index a163cd6044a..8eb8748e16a 100644
--- a/app/models/capability.rb
+++ b/app/models/capability.rb
@@ -37,7 +37,7 @@ class Capability < ApplicationRecord
belongs_to :context, class_name: "Project"
belongs_to :principal
- define_attribute :action, ActiveRecord::Type.lookup(:text), default: nil
- define_attribute :context_id, ActiveRecord::Type.lookup(:integer), default: nil
- define_attribute :principal_id, ActiveRecord::Type.lookup(:integer), default: nil
+ attribute :action, ActiveRecord::Type.lookup(:text), default: nil
+ attribute :context_id, ActiveRecord::Type.lookup(:integer), default: nil
+ attribute :principal_id, ActiveRecord::Type.lookup(:integer), default: nil
end
diff --git a/app/models/day.rb b/app/models/day.rb
index a182b8836db..1a14256a02f 100644
--- a/app/models/day.rb
+++ b/app/models/day.rb
@@ -36,9 +36,9 @@ class Day < ApplicationRecord
primary_key: :date,
dependent: nil
- define_attribute :date, ActiveRecord::Type.lookup(:date), default: nil
- define_attribute :day_of_week, ActiveRecord::Type.lookup(:integer), default: nil
- define_attribute :working, ActiveRecord::Type.lookup(:boolean), default: "t"
+ attribute :date, ActiveRecord::Type.lookup(:date), default: nil
+ attribute :day_of_week, ActiveRecord::Type.lookup(:integer), default: nil
+ attribute :working, ActiveRecord::Type.lookup(:boolean), default: "t"
delegate :name, to: :week_day, allow_nil: true