@@ -22,11 +22,11 @@ class Subscription < ApplicationRecord
2222 belongs_to :payment_source , polymorphic : true , optional : true
2323
2424 validates :user , presence : true
25- validates :skip_count , :successive_skip_count , presence : true , numericality : { greater_than_or_equal_to : 0 }
26- validates :interval_length , numericality : { greater_than : 0 }
25+ validates :skip_count , :successive_skip_count , presence : true , numericality : { greater_than_or_equal_to : 0 }
26+ validates :interval_length , numericality : { greater_than : 0 }
2727 validates :payment_method , presence : true , if : -> { payment_source }
2828 validates :payment_source , presence : true , if : -> { payment_method &.source_required? }
29- validates :currency , inclusion : { in : ::Money ::Currency . all . map ( &:iso_code ) }
29+ validates :currency , inclusion : { in : ::Money ::Currency . all . map ( &:iso_code ) }
3030
3131 validate :validate_payment_source_ownership
3232
@@ -44,8 +44,8 @@ class Subscription < ApplicationRecord
4444 # Find all subscriptions that are "actionable"; that is, ones that have an
4545 # actionable_date in the past and are not invalid or canceled.
4646 scope :actionable , ( lambda do
47- where ( "#{ table_name } .actionable_date <= ?" , Time . zone . today ) .
48- where . not ( state : [ "canceled" , "inactive" ] )
47+ where ( "#{ table_name } .actionable_date <= ?" , Time . zone . today )
48+ . where . not ( state : [ "canceled" , "inactive" ] )
4949 end )
5050
5151 # Find subscriptions based on their processing state. This state is not a
@@ -64,7 +64,7 @@ class Subscription < ApplicationRecord
6464 fulfilled_ids = fulfilled . pluck ( :id )
6565 where . not ( id : fulfilled_ids )
6666 when :pending
67- includes ( :installments ) . where ( solidus_subscriptions_installments : { id : nil } )
67+ includes ( :installments ) . where ( solidus_subscriptions_installments : { id : nil } )
6868 else
6969 raise ArgumentError , "state must be one of: :success, :failed, :pending"
7070 end
@@ -85,7 +85,7 @@ class Subscription < ApplicationRecord
8585
8686 # Scope for finding subscription with a specific item
8787 scope :with_subscribable , ( lambda do |id |
88- joins ( line_items : :subscribable ) . where ( spree_variants : { id : id } )
88+ joins ( line_items : :subscribable ) . where ( spree_variants : { id : id } )
8989 end )
9090
9191 def self . ransackable_scopes ( _auth_object = nil )
@@ -288,9 +288,9 @@ def failing_since
288288 failing_details = installment_details . failed . order ( 'solidus_subscriptions_installment_details.created_at ASC' )
289289
290290 last_successful_detail = installment_details
291- . succeeded
292- . order ( 'solidus_subscriptions_installment_details.created_at DESC' )
293- . first
291+ . succeeded
292+ . order ( 'solidus_subscriptions_installment_details.created_at DESC' )
293+ . first
294294 if last_successful_detail
295295 failing_details = failing_details . where (
296296 'solidus_subscriptions_installment_details.created_at > ?' ,
@@ -320,7 +320,7 @@ def validate_payment_source_ownership
320320 return if payment_source . blank?
321321
322322 if payment_source . respond_to? ( :user_id ) &&
323- payment_source . user_id != user_id
323+ payment_source . user_id != user_id
324324 errors . add ( :payment_source , :not_owned_by_user )
325325 end
326326 end
@@ -361,10 +361,10 @@ def tomorrow_or_after(date)
361361 def update_actionable_date_if_interval_changed
362362 if persisted? && ( interval_length_previously_changed? || interval_units_previously_changed? )
363363 base_date = if installments . any?
364- installments . last . created_at
365- else
366- created_at
367- end
364+ installments . last . created_at
365+ else
366+ created_at
367+ end
368368
369369 new_date = interval . since ( base_date )
370370
0 commit comments