Skip to content

Commit

Permalink
Use single line method definitions for defining context validations
Browse files Browse the repository at this point in the history
  • Loading branch information
dombesz committed Jan 23, 2025
1 parent 22aca58 commit d2ecd68
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions app/contracts/project_life_cycle_steps/base_contract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ class BaseContract < ::ModelContract
validate :select_custom_fields_permission
validate :consecutive_steps_have_increasing_dates

def valid?(context = :saving_life_cycle_steps)
super
end
def valid?(context = :saving_life_cycle_steps) = super

def select_custom_fields_permission
return if user.allowed_in_project?(:edit_project_stages_and_gates, model)
Expand Down
4 changes: 1 addition & 3 deletions app/contracts/projects/base_contract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ class BaseContract < ::ModelContract

validate :validate_user_allowed_to_manage

def valid?(context = :saving_custom_fields)
super
end
def valid?(context = :saving_custom_fields) = super

def assignable_parents
Project
Expand Down

0 comments on commit d2ecd68

Please sign in to comment.