Skip to content

Commit

Permalink
Rename WorkPackage#life_cycle_step to #project_life_cycle_step
Browse files Browse the repository at this point in the history
  • Loading branch information
dombesz committed Nov 22, 2024
1 parent beab112 commit 1a9d77e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/models/project/life_cycle_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Project::LifeCycleStep < ApplicationRecord
belongs_to :definition,
optional: false,
class_name: "Project::LifeCycleStepDefinition"
has_many :work_packages, inverse_of: :life_cycle_step, dependent: :nullify
has_many :work_packages, inverse_of: :project_life_cycle_step, dependent: :nullify

attr_readonly :definition_id

Expand Down
2 changes: 1 addition & 1 deletion app/models/work_package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class WorkPackage < ApplicationRecord
belongs_to :assigned_to, class_name: "Principal", optional: true
belongs_to :responsible, class_name: "Principal", optional: true
belongs_to :version, optional: true
belongs_to :life_cycle_step, class_name: "Project::LifeCycleStep", optional: true
belongs_to :project_life_cycle_step, class_name: "Project::LifeCycleStep", optional: true
belongs_to :priority, class_name: "IssuePriority"
belongs_to :category, class_name: "Category", optional: true

Expand Down
5 changes: 1 addition & 4 deletions db/migrate/20241105175000_add_life_cycle_to_work_packages.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
class AddLifeCycleToWorkPackages < ActiveRecord::Migration[7.1]
def change
add_reference :work_packages,
:life_cycle_step,
foreign_key: { to_table: :project_life_cycle_steps },
null: true
add_reference :work_packages, :project_life_cycle_step, null: true
end
end
2 changes: 1 addition & 1 deletion spec/models/work_package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
it { is_expected.to belong_to(:assigned_to).class_name("Principal").optional }
it { is_expected.to belong_to(:responsible).class_name("Principal").optional }
it { is_expected.to belong_to(:version).optional }
it { is_expected.to belong_to(:life_cycle_step).class_name("Project::LifeCycleStep").optional }
it { is_expected.to belong_to(:project_life_cycle_step).class_name("Project::LifeCycleStep").optional }
it { is_expected.to belong_to(:priority).class_name("IssuePriority") }
it { is_expected.to belong_to(:category).optional }
it { is_expected.to have_many(:time_entries).dependent(:delete_all) }
Expand Down

0 comments on commit 1a9d77e

Please sign in to comment.