@@ -26,12 +26,12 @@ class OutOfVIPException < CloudController::Errors::InvalidRelation; end
2626
2727 # TODO: apps are actually processes
2828 many_to_many :apps , class : 'VCAP::CloudController::ProcessModel' ,
29- join_table : RouteMappingModel . table_name ,
30- left_primary_key : :guid , left_key : :route_guid ,
31- right_primary_key : %i[ app_guid type ] , right_key : %i[ app_guid process_type ] ,
32- distinct : true ,
33- order : Sequel . asc ( :id ) ,
34- conditions : { type : ProcessTypes ::WEB }
29+ join_table : RouteMappingModel . table_name ,
30+ left_primary_key : :guid , left_key : :route_guid ,
31+ right_primary_key : %i[ app_guid type ] , right_key : %i[ app_guid process_type ] ,
32+ distinct : true ,
33+ order : Sequel . asc ( :id ) ,
34+ conditions : { type : ProcessTypes ::WEB }
3535
3636 many_to_many :shared_spaces ,
3737 left_key : :route_guid ,
@@ -77,23 +77,25 @@ def as_summary_json
7777 }
7878 end
7979
80- def options_with_serialization = ( opts )
81- self . options_without_serialization = Oj . dump ( opts )
82- end
83- alias_method :options_without_serialization= , :options=
84- alias_method :options= , :options_with_serialization=
80+ def options_with_serialization = ( opts )
81+ self . options_without_serialization = Oj . dump ( opts )
82+ end
8583
86- def options_with_serialization
87- string = options_without_serialization
88- return nil if string . blank?
84+ alias_method :options_without_serialization= , :options=
85+ alias_method :options= , :options_with_serialization=
8986
90- Oj . load ( string )
91- end
92- alias_method :options_without_serialization , :options
93- alias_method :options , :options_with_serialization
87+ def options_with_serialization
88+ string = options_without_serialization
89+ return nil if string . blank?
90+
91+ Oj . load ( string )
92+ end
9493
94+ alias_method :options_without_serialization , :options
95+ alias_method :options , :options_with_serialization
9596
9697 alias_method :old_path , :path
98+
9799 def path
98100 old_path . nil? ? '' : old_path
99101 end
@@ -182,8 +184,8 @@ def domains_match?
182184
183185 def validate_changed_space ( new_space )
184186 raise CloudController ::Errors ::InvalidAppRelation . new ( 'Route and apps not in same space' ) if !FeatureFlag . enabled? ( :route_sharing ) && apps . any? do |app |
185- app . space . id != space . id
186- end
187+ app . space . id != space . id
188+ end
187189 raise InvalidOrganizationRelation . new ( "Organization cannot use domain #{ domain . name } " ) if domain && !domain . usable_by_organization? ( new_space . organization )
188190 end
189191
@@ -241,8 +243,8 @@ def find_next_vip_offset
241243 # See SQL self-joins for the reasoning behind this
242244
243245 n = Route . exclude ( vip_offset : 1 ) .
244- exclude { vip_offset - 1 =~ Route . select ( :vip_offset ) } . order ( :vip_offset ) . get { vip_offset - 1 } ||
245- ( return ( Route . max ( :vip_offset ) || 0 ) + 1 )
246+ exclude { vip_offset - 1 =~ Route . select ( :vip_offset ) } . order ( :vip_offset ) . get { vip_offset - 1 } ||
247+ ( return ( Route . max ( :vip_offset ) || 0 ) + 1 )
246248 Route . where { vip_offset < n } . reverse ( :vip_offset ) . get { vip_offset + 1 } || 1
247249 end
248250
@@ -261,9 +263,9 @@ def internal_route_vip_range_len
261263
262264 def internal_route_vip_range
263265 @internal_route_vip_range ||= begin
264- internal_route_vip_range = Config . config . get ( :internal_route_vip_range )
265- NetAddr ::IPv4Net . parse ( internal_route_vip_range )
266- end
266+ internal_route_vip_range = Config . config . get ( :internal_route_vip_range )
267+ NetAddr ::IPv4Net . parse ( internal_route_vip_range )
268+ end
267269 end
268270
269271 def destroy_route_bindings
@@ -329,7 +331,7 @@ def validate_total_routes
329331 return unless new? && space
330332
331333 space_routes_policy = MaxRoutesPolicy . new ( space . space_quota_definition , SpaceRoutes . new ( space ) )
332- org_routes_policy = MaxRoutesPolicy . new ( space . organization . quota_definition , OrganizationRoutes . new ( space . organization ) )
334+ org_routes_policy = MaxRoutesPolicy . new ( space . organization . quota_definition , OrganizationRoutes . new ( space . organization ) )
333335
334336 errors . add ( :space , :total_routes_exceeded ) if space . space_quota_definition && !space_routes_policy . allow_more_routes? ( 1 )
335337
0 commit comments