Skip to content

Commit

Permalink
fix(subscription): not being active when creating and apply scope to …
Browse files Browse the repository at this point in the history
…user
  • Loading branch information
castrolem committed Oct 14, 2019
1 parent 7fb71a2 commit 7326544
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/controllers/subscription_charges_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def create
)

if charge
@subscription.active = true
@subscription.last_charge_at = DateTime.now
@subscription.save

Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class User < ApplicationRecord

SSO_ATTRIBUTES = %w[admin avatar_url banned custom_fields email name username].freeze

has_one :subscription
has_one :subscription, -> { where active: true }
has_many :cards
has_many :donations

Expand Down

0 comments on commit 7326544

Please sign in to comment.