File tree Expand file tree Collapse file tree 4 files changed +4
-48
lines changed Expand file tree Collapse file tree 4 files changed +4
-48
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ class ResurrectionExpiredError < StandardError; end
4545
4646 denormalizes :policy_id , from : :license
4747
48- accepts_nested_attributes_for :components , limit : 20 , reject_if : :reject_associated_records_for_components
48+ accepts_nested_attributes_for :components , limit : 20
4949 tracks_nested_attributes_for :components
5050
5151 # Machines firstly automatically inherit their license's group ID.
@@ -829,16 +829,6 @@ def default_proof_dataset
829829 }
830830 end
831831
832- def reject_associated_records_for_components ( attrs )
833- return if
834- new_record?
835-
836- components . exists? (
837- # Make sure we only select real columns, not e.g. _destroy.
838- attrs . slice ( attributes . keys ) ,
839- )
840- end
841-
842832 # atomically update license's counter caches on machine create, update, and destroy
843833 # FIXME(ezekg) move this into an attribute counter cache concern?
844834 {
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ class Release < ApplicationRecord
101101 has_environment default : -> { product &.environment_id }
102102 has_account default : -> { product &.account_id } , inverse_of : :releases
103103
104- accepts_nested_attributes_for :constraints , limit : 20 , reject_if : :reject_associated_records_for_constraints
104+ accepts_nested_attributes_for :constraints , limit : 20
105105 tracks_nested_attributes_for :constraints
106106
107107 accepts_nested_attributes_for :channel
@@ -917,16 +917,6 @@ def validate_associated_records_for_channel
917917 self . channel = rows . first
918918 end
919919
920- def reject_associated_records_for_constraints ( attrs )
921- return if
922- new_record?
923-
924- constraints . exists? (
925- # Make sure we only select real columns, not e.g. _destroy.
926- attrs . slice ( attributes . keys ) ,
927- )
928- end
929-
930920 def enforce_release_limit_on_account!
931921 return unless account . trialing_or_free?
932922
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ def actions = loaded? ? collect(&:action) : super
4545 allow_nil : true ,
4646 to : :resource
4747
48- accepts_nested_attributes_for :role_permissions , reject_if : :reject_associated_records_for_role_permissions
48+ accepts_nested_attributes_for :role_permissions
4949 tracks_nested_attributes_for :role_permissions
5050
5151 # Set default permissions unless already set
@@ -226,18 +226,6 @@ def set_default_permissions
226226 )
227227 end
228228
229- ##
230- # reject_associated_records_for_role_permissions rejects duplicate role permissions.
231- def reject_associated_records_for_role_permissions ( attrs )
232- return if
233- new_record?
234-
235- role_permissions . exists? (
236- # Make sure we only select real columns, not e.g. _destroy.
237- attrs . slice ( attributes . keys ) ,
238- )
239- end
240-
241229 ##
242230 # autosave_associated_records_for_role_permissions bulk inserts role permissions instead
243231 # of saving them sequentially, which is incredibly slow with 100+ permissions.
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ def actions = loaded? ? collect(&:action) : super
4545 # Default to wildcard permission but allow all
4646 default : %w[ * ]
4747
48- accepts_nested_attributes_for :token_permissions , reject_if : :reject_associated_records_for_token_permissions
48+ accepts_nested_attributes_for :token_permissions
4949 tracks_nested_attributes_for :token_permissions
5050
5151 tracks_attributes :expiry
@@ -440,18 +440,6 @@ def set_default_expiry
440440 end
441441 end
442442
443- ##
444- # reject_associated_records_for_token_permissions rejects duplicate token permissions.
445- def reject_associated_records_for_token_permissions ( attrs )
446- return if
447- new_record?
448-
449- token_permissions . exists? (
450- # Make sure we only select real columns, not e.g. _destroy.
451- attrs . slice ( attributes . keys ) ,
452- )
453- end
454-
455443 ##
456444 # autosave_associated_records_for_token_permissions bulk inserts token permissions instead
457445 # of saving them sequentially, which is incredibly slow with 100+ permissions.
You can’t perform that action at this time.
0 commit comments